Bug #69182 [Ver->Csd]: imagecropauto function not properly documented

From: Date: Mon, 11 Jul 2016 17:56:22 +0000
Subject: Bug #69182 [Ver->Csd]: imagecropauto function not properly documented
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202207@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69182&edit=1 ID: 69182 Updated by: cmb@php.net Reported by: omid dot khodatars at gmail dot com Summary: imagecropauto function not properly documented -Status: Verified +Status: Closed Type: Bug Package: GD related Operating System: windows PHP Version: 5.5.22 Assigned To: cmb Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2016-07-11 17:56:14] cmb@php.net This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. And special thanks to jordie at jordie dot org for his note, which was rather helpful for the documentation. ------------------------------------------------------------------------ [2016-07-11 17:54:31] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339649 Log: Fix #69182: imagecropauto function not properly documented ------------------------------------------------------------------------ [2016-07-11 16:46:15] cmb@php.net I've found that imagecropauto() returns FALSE, if there is nothing to crop, e.g.: <?php $im = imagecreatetruecolor(100, 100); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 99, 99, $black); $thumb = imagecropauto($im ,IMG_CROP_WHITE); var_dump($thumb); outputs bool(false) I assume that was the case for your img.png, so I'm changing to documentation bug. ------------------------------------------------------------------------ [2016-07-11 16:30:09] cmb@php.net Apparently, in your case imagecropauto() returns false. I can't reproduce this behavior, however (tested with PHP 5.5.20 and 5.6.15 on Windows). If you still experience this problem on recent PHP versions, please provide the image (img.png) you've used. BTW: the $threshhold and $color arguments are needed only if $mode==IMG_CROP_THRESHOLD. ------------------------------------------------------------------------ [2015-03-04 12:07:12] omid dot khodatars at gmail dot com Description: ------------ --- From manual page: http://www.php.net/function.imagecropauto --- Test script: --------------- here is the code $ini_filename = 'img.png'; $im = imagecreatefrompng($ini_filename ); $to_crop_array = array('x' =>310 , 'y' => 0, 'width' => 573, 'height'=> 500); $thumb_im = imagecropauto($im ,IMG_CROP_WHITE , .5 ,-1 ); // $thumb_im = imagecrop($im, $to_crop_array); imagepng($thumb_im, 'imgOut.png', 9); and here is the error Warning: imagepng() expects parameter 1 to be resource, boolean given in ... on line 9 it is working fine with imagecrop() by the way. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69182&edit=1

« previous php.bugs (#202207) next »