|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-30 17:53 UTC] adrive at hip-hop dot sk
Description:
------------
Crop won't work as I expected. I cannot crop image twice.
When I crop image first time, the result is as expected, but when I crop the image afterwards, the result is in another size. Doesn't matter wheter I am using cropImage function or cropImageThumbnail.
It doesn't matter whether I am cloning the object or crop the same instance of object twice. The result is the same - invalid dimensions of the last image.
Reproduce code:
---------------
$res = new Imagick('/home/kmet/teaser_image.jpg');
header('Content-type: image/jpeg;');
$res->cropThumbnailImage(100, 100);
// echo $res
$thumb = $res->clone();
$thumb->cropThumbnailImage(100, 40);
echo $thumb;
Expected result:
----------------
cropThumbnailImage on the 3rd line works well. The image is resized and cropped to center perfectly and the new image dimesions are now 100x100 pixels.
cropThIm on the 7th line crops the image, but the new image dimensions are strange for some reasons: 45x40 pixels. Not the expected 100x40.
Actual result:
--------------
$thumb->cropThumnailImage(100x100) returns 100x100 pixels image
$thumb->cropThumnailImage(100x40) returns 45x40 pixels image afterwards.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 25 22:00:01 2025 UTC |
Hello, try the following code: $res = new Imagick('/home/kmet/teaser_image.jpg'); header('Content-type: image/jpeg;'); $res->cropThumbnailImage(100, 100); $res->setImagePage(100, 100, 0, 0); // echo $res $thumb = $res->clone(); $thumb->cropThumbnailImage(100, 40); echo $thumb; I added a call to MagickSetImagePage from cropThumbnailImage as well and it should be in the next release.