By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,751 Members | 1,158 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,751 IT Pros & Developers. It's quick & easy.

asking your opinion on server side image compression

n8kindt
100+
P: 221
i was wondering if it would be practical to upload a large image and have php compress it into a thumbnail/medium size when called upon? i'm thinking it might be too much of a load on the server and i would be better off uploading one picture and have php compress and save three different sizes of the same file rather than rendering it upon user request. but i'm no expert on this so i thought i would ask... what do you guys think?
Sep 16 '08 #1
Share this Question
Share on Google+
2 Replies


pbmods
Expert 5K+
P: 5,821
Heya, n8kindt.

It's generally a good idea to create prefab thumbnails, since image manipulation is particularly memory-intensive, and it could be crippling if you wanted to display a significant number of thumbnails on a page.

If you want the flexibility of being able to specify any size (and perhaps adding effects such as drop shadow on the fly), you might create a "cache-on-write" solution where the script will cache the image the first time you request it.

E.g., if you wanted to display an image at 25x25, you would run the script which would first check to see if it had a 25x25 version of that image. If so, it would fetch the cached version. If not, it would generate and then cache the image, then return the generated image.

If space is a consideration, you might need to implement your own cache management system, or consider using Memcached (http://php.net/memcache).
Sep 17 '08 #2

n8kindt
100+
P: 221
Heya, n8kindt.

It's generally a good idea to create prefab thumbnails, since image manipulation is particularly memory-intensive, and it could be crippling if you wanted to display a significant number of thumbnails on a page.

If you want the flexibility of being able to specify any size (and perhaps adding effects such as drop shadow on the fly), you might create a "cache-on-write" solution where the script will cache the image the first time you request it.

E.g., if you wanted to display an image at 25x25, you would run the script which would first check to see if it had a 25x25 version of that image. If so, it would fetch the cached version. If not, it would generate and then cache the image, then return the generated image.

If space is a consideration, you might need to implement your own cache management system, or consider using Memcached (http://php.net/memcache).
i figured it was probably a better idea to just store 3 images. however, you had a very interesting suggestion. i could perhaps use that in the future for another project i have in mind. thanks for the reply!

nate
Sep 17 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.