Displaying a Thumbnail vs. creating a thumbnail

D

David Lozzi

Hello,

I'm wondering whats the best method to use for displaying several photos'
thumbnails. One method I know is to dynamically resize the photo at the time
the page is loaded. What does this do to server/site performance? The other
is to copy the photo at time of upload and create a thumbnail then, have two
separate images, therefor when displaying its just pulling the actual image.

What do you think??
 
J

john smith

David said:
Hello,

I'm wondering whats the best method to use for displaying several photos'
thumbnails. One method I know is to dynamically resize the photo at the time
the page is loaded. What does this do to server/site performance? The other
is to copy the photo at time of upload and create a thumbnail then, have two
separate images, therefor when displaying its just pulling the actual image.

What do you think??

Creating thumbnails on the fly, every single time they're displayed is
CPU intensive (especially if there are a good number of visitors at the
same time). And if your images are big it can also generate a good
amount of disk IO (assuming images don't have built-in thumbnails or
that you don't use them - actually generating them), say you're
displaying 50 images/page, and that the source is 50 ~1MB jpegs, then it
has 50MB of images to read from disk before it can even resize them
(that's a lot of data to process too), for every single page load.

What I usually do is look for the thumbnail at page load, if it's not
there then generate it and save a copy to the disk for future page loads
(only needs to be generated once). That way there's no issue of
maintaining thumbnails either (like, if someone adds pics to the site by
FTP'ing them or such, your upload page won't generate thumbnails, then
what? What if they got deleted? etc)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top