简体   繁体   English

PHP图像大小调整和裁剪

[英]PHP Image Resize and Cropping

Is there anything out there in the PHP world with equivalent functionality to SORL thumbnail (a Django project). 在PHP世界中,有没有与SORL缩略图(Django项目)等效的功能。

Specifically: 1) It caches results (generating thumbnails on the fly is too cpu intensive). 具体来说:1)它缓存结果(即时生成缩略图过于占用CPU)。 2) It provides a smart cropping feature that crops to fit based on image entropy (so it doesn't just crop to center, but rather crops where the 'action' is). 2)它提供了一种智能的裁剪功能,可以根据图像熵进行裁剪以适应尺寸(因此,它不仅可以裁剪到居中位置,还可以裁剪“动作”所在的位置)。

The big feature I'm looking for is the smart cropping ability. 我要寻找的最大功能是智能裁剪功能。

Only image manipulator I knew off the bat was 我唯一知道的图像操纵器是

php.net/manual/en/book.image.php php.net/manual/en/book.image.php

But after some quick Googling found 但是经过一番快速搜索之后,

http://www.ajquick.com/programming/thumbnail/ http://www.ajquick.com/programming/thumbnail/

Hope one of those helps. 希望这些帮助之一。

I found a drupal module from which I can lift some php code: 我找到了一个drupal模块,可以从中提取一些php代码:

http://github.com/dylantack/codename_cornbaby http://github.com/dylantack/codename_cornbaby

It's actually based on the same django-sorl-thumbnail approach cited, so that's perfect. 它实际上是基于引用的django-sorl-thumbnail方法,因此非常完美。

If you do land up on this question, though its a very old one, you can try tools like ImageKit.io which provide smart cropping out of the box. 如果您确实对这个问题有所了解,尽管它是一个非常古老的问题,则可以尝试使用ImageKit.io之类的工具,它们可以提供开箱即用的智能裁剪功能 It uses face and feature detection internally to make the necessary computations for smart crop. 它内部使用面部和特征检测来进行智能作物的必要计算。 ImageKit also has a face-crop mode that picks out the face from the original image to create a thumbnail. ImageKit还具有脸部修剪模式,该模式可以从原始图像中挑选出脸部以创建缩略图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM