PHP Thumbnails

匆匆过客 提交于 2019-12-04 18:32:42

You want to use ImageMagick. It is much more efficient in handling large images than GD.

If all you want to do is generate thumbnails. I recommend this nice little script called imagethumb.php. You can download it here:http://www.olivo.net/software/imagethumb/

This script produces excellent thumbnails with absolutely no pixelation. It accepts a height or width argument that you append to the URL that calls the script. It's really really easy to use and comes with documentation (which you'll read for all of 2 minutes).

I tried other thumbnailing scripts such as "ThumbsUp" (for example) before landing on this one. BTW, it also renders .png images and also .gif (if I recall correctly). The cache feature will make it easier on your server if you have large files. Also, I assume that your server has the GD library or ImageMagick installed. Good Luck ;)

As the others have said, if the images are that big it's time to drop GD and switch to ImageMagick. One word of warning though: do it all on the command-line - the class wrappers out there are wheels in need of damn good re-inventing, every last one.

Assaf Lavie

Consider using a command-line based approach. For example, you can invoke ImageMagick from the command-line to resize images.

Other than that, in pure PHP, it's hard to see how you can edit images that are larger (in RGB format) than your RAM...

I was doing some research on the topic and I found Imagick much more efficient for manipulating bigger images. You`ll either pass the allowed memory or the maximum execution time. A better approach would be to use Imagick library. Check the onfo on how to generate thumbnails with php on the fly using Imagick.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!