本文介绍了PHP缩略图类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个可靠的PHP缩略图生成类。有谁知道任何开源的好的?

I am looking for a solid PHP thumbnail generating class. Does anyone know any good ones that are open-source?

我可以写一个,但我真的不想。我最讨厌PHP的一件事就是用GD和Imagemagick操纵图像。

I could write one, but I really don't want to. The one thing I hate most about PHP is manipulating images with GD and Imagemagick.

有没有人有任何建议?

推荐答案

使用。它是一个内部使用GD库和/或ImageMagick的脚本(无论哪个可用,无论哪个最适合作业)来执行基本的图像处理任务,包括缩略图生成和方形缩略图生成。

Use phpThumb(). Its a script that internally uses GD library and/or ImageMagick (whichever is available and whichever it thinks is best for the job) to perform basic image manipulation tasks, including thumbnail generation and square thumbnail generation.

您可以这样使用它:

<!-- best fit -->
<img src="/phpThumb/phpThumb.php?src=/path/to/image.jpg&w=64&h=64">
<!-- crop fit (square thumbnails) -->
<img src="/phpThumb/phpThumb.php?src=/path/to/image.jpg&w=64&h=64&zc=1">

它内置了缓存引擎,所以第二次浏览器请求上面的图像时它是自己提供的缓存而不是每次重新生成缩略图。但是,您可能需要花一个小时左右来配置它。

It has built in caching engine so second time a browser requests the above image it is served from its own cache instead of re-generating the thumbnail every time. Though, you may want to spend an hour or so configuring it.

这篇关于PHP缩略图类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 04:39