Home | About
| Archive
|
Blog
|
Subscribe
|
Feed
|
Contact
|
Links
|
3.03.2008Making It WorkI thought I'd talk about some of the technology behind LeftyRodriguez.Com today, since I've had a couple of people ask me about how I upload pictures and display them. Secondly, this post might be pretty boring to non-technical people, so please forgive me. Speaking of dynamically generating pages, you'll notice that the index page (the main one that displays the posted images) and the archive pages end in the .asp file extension, meaning they are written in Classic ASP (perhaps one day I'll get around to upgrading them to ASP.Net). ASP stands for Active Server Page and is Microsoft's (old) technology for dynamically creating HTML pages on the server before sending them to the end-user's web browser (which, of course, should be Firefox). Basically, ASP allows me to write the pages as a script that does things like query the database for image information then use this information to generate the page presented to the end-user on the fly. If we didn't have technology like ASP or PHP (ASP's open-source cousin), every time I added a new picture, I'd have to manually update the archive page and the index page, as well as having a different html page for each image, which wouldn't be fun enough for me to actually do everyday, so this would be one sorry photoblog that would probably hold my attention for about a week. The basic operation of the index page happens like this: When you navigate to LeftyRodriguez.Com, index.asp is automatically loaded. When my web server (hosted by Brinkster) gets the request for the main page, it finds index.asp and interprets the code contained in it. First, it opens a connection to the database and queries for the newest image and its relevant data (Caption/Image Name, description, EXIF data for the mouseover). Then it uses this data to build the actual html page sent to your web browser. Page decoration/style is an ugly mixture of both inline styles and CSS (I promise I'll fix this at some point). The archive page works the same way, except it queries the database for all posted images and then uses a loop to generate the table holding each individual thumbnail. Okay, great, you say, you just threw a bunch of technical mumbo-jumbo my way, but how do you get the images onto your web server. Well, don't worry, there's more mumbo-jumbo to come! For the first couple of months of operation, I had a page I could navigate to with my browser to upload images. This was another .asp page that would let me choose an image on my local PC, fill in the caption and description and click an "Upload" button. The page would then upload the images to the server, resize them (one for the thumbnail and one for the high-resolution main page) and update the database with the image's information. The problem with this approach was two-fold: first, the image-resizing program didn't always do a satisfying job, leaving the images with ugly artifacts; second, sometimes my web server would return an "Out-Of-Memory" error while attempting the resize and I'd either have to wait for my hosting provider to fix the memory issue or manually resize the images, upload them to the web site via FTP and then manually enter the image's data into the database, which was time-consuming and "un-fun".
This was great and all for a few days, but I started thinking about another issue: what if I wanted to go out of town for a few days or weeks and didn't have access to a my PC or laptop to upload images? I had to have a way to queue up images so that they could be posted in advanced, but not actually viewable until I desired. Aha, I thought, I can queue up pictures by assigning a date/time for them to post then having the code that queries the database look for only images that have a date/time that's already passed. For instance, right now there are about four images in my photoblog queue that have dates in the future, so they won't show up until after 6:30 EST on the day they are assigned (I arbitrarily chose 6:30 EST because I'd gotten into the habit of manually posting my images the old way every night after I'd come home from work, which was usually around 5:30 Central Time).
posted by Lefty Rodriguez at
18:44
|
0 Comments:
Post a Comment
<< Home