php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59029 Gmagick::cropthumbnailimage doesn't work
Submitted: 2010-01-14 12:47 UTC Modified: 2010-02-10 18:13 UTC
From: mmalone at nutshell dot com Assigned: vitoc (profile)
Status: Closed Package: gmagick (PECL)
PHP Version: 5_3.1RC2 OS: Mac OS 10.6.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
43 - 6 = ?
Subscribe to this entry?

 
 [2010-01-14 12:47 UTC] mmalone at nutshell dot com
Description:
------------
Maybe I'm misunderstanding the purpose of this function, but it's producing strange and counter-intuitive results, and it's definitely inconsistent with the Imagick function of the same name. 

Here's a version of the reproduce code that uses Imagick::cropThumbnailImage(). It corresponds to what I put in "Actual results", since it behaves as I would expect from the description.
<?
if (!file_exists('php.gif')) {
    file_put_contents('php.gif', file_get_contents('http://www.php.net/images/php.gif'));
}

$image = new Imagick('php.gif');
echo "Width: {$image->getImageWidth()}, height: {$image->getImageHeight()}\n";

$thumb = $image->clone();
$thumb->cropThumbnailImage(50, 50);
echo "Thumbnail width: {$thumb->getImageWidth()}, height: {$thumb->getImageHeight()}\n";
$thumb->writeImage('php_thumbi.gif');


Reproduce code:
---------------
<?
if (!file_exists('php.gif')) {
    file_put_contents('php.gif', file_get_contents('http://www.php.net/images/php.gif'));
}

$image = new Gmagick('php.gif');
echo "Width: {$image->getImageWidth()}, height: {$image->getImageHeight()}\n";

$thumb = $image->cropThumbnailImage(50, 50);
echo "Thumbnail width: {$thumb->getImageWidth()}, height: {$thumb->getImageHeight()}\n";
$thumb->write('php_thumb.gif');

Expected result:
----------------
EXPECTED OUTPUT:
Width: 120, height: 67
Thumbnail width: 50, height: 50

EXPECTED IMAGE:
http://img29.imageshack.us/img29/6033/phpthumbi.gif


Actual result:
--------------
ACTUAL OUTPUT:
Width: 120, height: 67
Thumbnail width: 31, height: 50

ACTUAL IMAGE:
http://img251.imageshack.us/img251/2497/phpthumb.gif

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-14 12:49 UTC] mmalone at nutshell dot com
typo:
"It corresponds to what I put in "Actual results"," 
should be 
"It corresponds to what I put in "Expected results","
 [2010-01-21 08:43 UTC] andy at steamshift dot net
same result on Ubuntu 8.04.3
 [2010-01-30 23:01 UTC] spinn909 at gmail dot com
Same result on Debian 5.0.3
 [2010-02-10 18:13 UTC] mkoppanen@php.net
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Sep 21 19:01:26 2019 UTC