Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hello:

 

I'm trying to create a client area for my photography website. In Chapter 17, a table called Prints was created using the type VARCHAR for the image of the print.

 

Why are you using VARCHAR instead of one of the BLOB types?

Link to comment
Share on other sites

The image is probably saved as a normal file, while only the path to the image is stored in the db. This solution will allow you to link to a thumbnail too. (another column for thumbnail path)

 

Another possiblity is storing the thumbnail with something like a "t" (for thumbnail) at the end of the name. For example 3453432t.jpg. (thumbnail of 3453432.jpg) The last version is very good if you also create thumbnails of an uploaded image automaticly or through an user interface.

Link to comment
Share on other sites

A thumbnail size of the image would be great to store in a DB.

 

I'm trying to achieve the following. A client will login into a client area. The client is then brought to a page where a gallery of thumbnails appear which are specifically for that client. Then, the client can click on the thumbnail and a new window will open with the large image.

 

Any thoughts on how I can accomplish this? I'm using the scripting in the Effortless E-Commerce book of Mr. Ullman.

Link to comment
Share on other sites

You probably need two sets of pictures stored in your directory, i thumbnail size and the larger size. You would then display the thumbnail picture in the product page then you would load the original size picture when clicked on. Well i have seen some web frameworks use this method, or another way would be to do make the thumbnail pictures with the code when the page loads up. I have seen some code for making thumbnails in the PHP Solutions Dynamic Web Design Made Easy (David Powers), if you venture into this.

Link to comment
Share on other sites

I would advise, store the name of the file in the database and not the file itself. On upload, generate a separate file for the thumbnail, which you reference via the code e.g. original_filename.jpg and generate original_filanme_tbn.jpg. Then on thumbnail gallery pages reference the original file name from the database with whatever you use as a designator for the thumbnail image.

 

Generating the thumbnail images during a page request by the user is a really bad idea; you're ultimately penalising the user in terms of time, you should really address thumbnail creation at the point of uploading the original image.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...