hadoob024 Posted July 31, 2007 Share Posted July 31, 2007 I've seen a lot of posts regarding how to create thumbnails, but I haven't seen anything regarding WHEN to create the thumbnail (i.e., during the original image upload, before displaying the image, etc.), or if it's even worth it to use thumbnails. Our website is a listing service for real estate. Each listing can have up to 4 jpg/gif images up to 500k in size each. On a page, we can have up to either 10 or 25 listings. My first question is, when should I create these thumbnail images (i.e., during the original image upload, before displaying the image, etc.)? My second question is, is it even worth it to create thumbnails, or can I just display the original images and just resize them in the <IMG> tag? How server intensive is creating these images? Is it even worth it to create thumnails, or should I just continue with displaying the original image? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/62696-to-use-thumbnails-or-not/ Share on other sites More sharing options...
micah1701 Posted July 31, 2007 Share Posted July 31, 2007 create the thumbnails on upload. That way you create the file once and its saved on your server and can easily be called and read over and over again. if you create them "on the fly" it has to be built over and over again each time a user sees it. The purpose of thumbnails is so the user doesn't have to download the full size version of an image (unless they want to click on it) -- if you don't create the thumbnail until they view it - then they still have to wait for the full image to be processed each time. (only its being processed on your server, instead of in their browser) as to your 2nd question - do the thumbnails. even though a lot of people have lightning fast internet connections -- it is STILL very annoying to download a 500k image (albeit reshaped in the IMG tag) and it is a huge waste of bandwidth. both yours and theirs. Quote Link to comment https://forums.phpfreaks.com/topic/62696-to-use-thumbnails-or-not/#findComment-312123 Share on other sites More sharing options...
hadoob024 Posted July 31, 2007 Author Share Posted July 31, 2007 Cool! Thanks! Yeah, that makes sense. I don't know why I had it in my head to create them just before displaying them. Duh! Oh well. That's how you learn. Also, I've seen several examples for creating thumbnails, and was just wondering if there's a "preferred" way of doing it? All the variations make use of the following functions: imageCreateFromJPEG, imageSX, imageSY, ImageCreateTrueColor, imageCopyResampled, imageJPEG, imagedestroy, etc. Any caveats in actually creating the thumbnails? Quote Link to comment https://forums.phpfreaks.com/topic/62696-to-use-thumbnails-or-not/#findComment-312274 Share on other sites More sharing options...
chombone Posted July 31, 2007 Share Posted July 31, 2007 Imagecopyresized is quicker, but imagecopyresampled gives smoother results. If you aren't creating it at display-time I'd use the latter. Quote Link to comment https://forums.phpfreaks.com/topic/62696-to-use-thumbnails-or-not/#findComment-312361 Share on other sites More sharing options...
hadoob024 Posted July 31, 2007 Author Share Posted July 31, 2007 Nice. OK. I'll make sure to use imagecopyresampled then because I'll probably do all the thumbnail transformations after verifying the uploads. Quote Link to comment https://forums.phpfreaks.com/topic/62696-to-use-thumbnails-or-not/#findComment-312380 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.