php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58403 Bug in cropThumbnailImage
Submitted: 2008-11-03 10:25 UTC Modified: 2008-11-03 11:13 UTC
From: php at rijkvanwel dot nl Assigned:
Status: Closed Package: imagick (PECL)
PHP Version: 5.2.5 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at rijkvanwel dot nl
New email:
PHP Version: OS:

 

 [2008-11-03 10:25 UTC] php at rijkvanwel dot nl
Description:
------------
The cropThumbnailImage doesn't work as expected, 
reproducable with the image .

Reproduce code:
---------------
$Imagick = new Imagick();
$Imagick->readImageBlob( file_get_contents( 'http://www.solware.nl/resources/images/solware-logo.gif' ) );
$Imagick->cropThumbnailImage( 64, 64 );

header('Content-type: image/jpeg');
echo $Imagick;

Expected result:
----------------
GIF image, 64x64

Actual result:
--------------
GIF image, 128x64

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-03 11:02 UTC] mkoppanen@php.net
GIFs have virtual canvas so simple resize isn't usually enough to display correctly in browser. I noticed that you're also trying to send it out with jpeg headers.

What happens if you try this code:

$Imagick = new Imagick();
$Imagick->readImageBlob( file_get_contents(
'http://www.solware.nl/resources/images/solware-logo.gif' ) );
$Imagick->cropThumbnailImage( 64, 64 );
$Imagick->setImagePage(64,64,0,0);
$Imagick->setImageFormat('gif'); 

header('Content-type: image/gif');
echo $Imagick;
 [2008-11-03 11:13 UTC] php at rijkvanwel dot nl
Yes, it is working now! Although your code worked, I've 
changed it to:

$Imagick = new Imagick();
$Imagick->readImageBlob( file_get_contents( 
'http://www.solware.nl/resources/images/solware-logo.gif' ) 
);
$Imagick->setImageFormat('jpeg');
$Imagick->cropThumbnailImage( 64, 64 );

header('Content-type: image/jpeg');
echo $Imagick;

Thanks for your help, sorry for the bogus report.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 16:02:26 2025 UTC