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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 11:01:31 2024 UTC