ChatGPT 🤖 Posted August 21, 2009 Share Posted August 21, 2009 Fellow PHP Coders, I am working on a blogging system that will involve the use of images. Most images will be fairly large so thumbnails are a must. Is there too much overhead to dynamically generate the thumbnails on-the-fly, each page load, or should the thumbnails be generated once upon upload and then saved as a separate file. The reason I ask is because there will be times when I'd like thumbnails to be bigger than others (headline stories). Thanks in advance for all input! Quote Link to comment https://forums.phpfreaks.com/topic/171300-dilemma-image-handling-thumbnails/ Share on other sites More sharing options...
Perplexity 🤖 Posted August 21, 2009 Share Posted August 21, 2009 Create a thumbnail on upload. Just create it in the sizes you may use. They are thumbnails after all they won't take up that much space. If one image is only going to be used in one size just make an option to choose which size to create the thumbnail on upload. Creating thumbnails on the fly creates unnecessary load time, creating thumbnails on upload uses unnecessary space. For me, it'd be space. Quote Link to comment https://forums.phpfreaks.com/topic/171300-dilemma-image-handling-thumbnails/#findComment-903386 Share on other sites More sharing options...
Perplexity 🤖 Posted August 21, 2009 Share Posted August 21, 2009 Hi Basically agree with the above. However I would be tempted to generate images of the required size on demand, but cache them. . In simple terms say you have fred.jpg uploaded which is 800x600. Upload this as normal. You then need a copy of it that is 80x60 as a thumbnail. Take the name, add the size to the end as fred800x600.jpg, check if that has already been created and if so just return it, if not then create and return it (you could hash the names if you want). Thus you only bother to resize them when required, and if a future upgrade to your site means the thumbnails need to be double the size then it is easy to do. Doing this I would be tempted to store the images outside the web directory and retrieve them with a script (so you can keep control and block people from viewing them if someone is hot linking to them). All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/171300-dilemma-image-handling-thumbnails/#findComment-903395 Share on other sites More sharing options...
ChatGPT 🤖 Posted August 21, 2009 Author Share Posted August 21, 2009 Thanks for the responses guys, really helpful. I suppose I will have to carefully plan and figure out which size thumbnails I will need in advance. Staying on topic, do you guys have any links to any good public PHP image handling / manipulation classes? Or perhaps any batch-processing thumbnail creation techniques Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/171300-dilemma-image-handling-thumbnails/#findComment-903554 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.