Forum Moderators: coopster
There are a lot of thumbnails on my website, and with 1000-1500 daily visitors I'm afraid the script is going to kill my server one day.
Reducing the amount of thumbnails is not an option.
I've tried looking for alternative on-the-fly thumbnail scripts, but they all seem the same to me.
What do you suggest I should do? Abandon on-the-fly generation with caching, and simply generate thumbnails upon uploading, or is there a way to modify ImageThumb to consume less CPU? Alternatively, does anybody know a different script that requires less resources.
All help is greatly appreciated.
Thanks!
[edited by: coopster at 8:55 pm (utc) on Mar. 26, 2008]
[edit reason] unlinked url [/edit]
I had the same question when I designed an image-on-the-fly site. I decided to have the thumbnails created and stored on the server when the larger image was created or uploaded rather than try to generate thumbs each time they needed to be viewed. At first I had the thumbs created dynamically, but the wait time and server load just wasn't worth the relatively small amount of storage space I gained. I'm not sure how many thumbs you're talking, but the site I referenced currently has over 1500 images, each with it's own thumbnail, and I don't even notice the space missing.
My visitors probably appreciate it too when they're browsing and only need to wait for the image to download rather than be both generated AND downloaded.
I've tried looking for alternative on-the-fly thumbnail scripts...
I'm just curious as to why one would choose to generate thumbnails on-the-fly (when requested by the user) instead of generating and storing the thumbnail as a once off when the image(s) are first uploaded (when that is a possibility)?
Not cool enough, I'm afraid, to ignore the load it places on the server and the wait time it incurs on the browser. It's fine if you're only showing one image or thumbnail at a time, but if you want users to browse through multiple thumbnails on a page they should probably be stored on the server and ready to go. That way all they need is to be downloaded by the browser.
In any case, all the thumbnail generation code I have is from scratch using GD, so I'm not familiar with any ready-made classes, but I'm sure they exist. Thumbnail generation is a pretty common task.
The other common trouble with dynamic image generation is not sending the right headers for the client to cache the image. It's possible too that the users aren't caching the thumbnails, so every time they load a page they have to go back to your server to get the thumbnails.
I've done these before, but always from scratch.