问题
Possible Duplicate:
PHP image resize on the fly vs storing resized images
I was wondering what is the best, fastest and most resource efficient way to resize images on the fly? I have the idea of generating thumbnails and special sizes of images from a photo gallery on-the-fly when they are requested.
Is this a good idea? and what is the best way?
PHP, Imagemagick, litespeed server
回答1:
I have successfully created a on the fly image refactoring application using Imagemagick. The performance is great and I am able to resize/crop/watermark/reformat etc all via a restful request. I use memcache to cache the binary blob of the refactored image and this gives me a massive performance boost.
EDIT: I used the Java Imagemagick libs initially and kept running into issues, the PHP libs are far better imho ( this was about a year ago, its possible that the Java libs have improved )
回答2:
I'd recommend NOT to create thumbnails on the fly or at least caching them (for example by saving to the HD) You can generate them for example with phpThumb: http://phpthumb.sourceforge.net/ which uses GD or ImageMagick
Hope that helps.
回答3:
I'm not familiar with many options, but as far as my experience goes I'd go for ImageMagick, it's quite fast when executed command-line. Updates on ImageMagick and backwards compatibility can be the cause of unforeseen bugs though. When generating many images on the fly it might be an idea to perform the thumbing on a different / dedicated server. And make sure to cache them.
来源:https://stackoverflow.com/questions/9464618/on-the-fly-thumbnail-resize-generation-of-images