AnNaMaLaI
AnNaMaLaI

Reputation: 4084

ImageMagick PHP need a good quality thumbnail generation

I am using php imagemagick to generate thumbnail image.

I need a solution that whatever the image size(minimum i will upload 200X200) i give it need to give 50x50 with good quality and techniques there in ImageMAgick ??

Upvotes: 2

Views: 2929

Answers (2)

Benjamin Cremer
Benjamin Cremer

Reputation: 4822

Take a look at PHP Thumb (MIT license).

It supports Adaptive Resizing.

What it does is resize the image to get as close as possible to the desired dimensions, then crops the image down to the proper size from the center.

require_once '/path/to/ThumbLib.inc.php';  

$thumb = PhpThumbFactory::create('test.jpg');  
$thumb->adaptiveResize(50, 50)->save('/path/to/new_thumb.jpg');  

PHP Thumb is a light-weight image manipulation library aimed at thumbnail generation. It features the ability to resize by width, height, and percentage, create custom crops, or square crops from the center, and rotate the image.

PHP Thumb Github WIKI

Upvotes: 1

binaryLV
binaryLV

Reputation: 9122

Use $im->cropThumbnailImage() instead of $im->thumbnailImage().

Upvotes: 2

Related Questions