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

From: Date: Mon, 11 Jul 2016 16:46:15 +0000
Subject: Bug #69182 [Fbk->Ver]: imagecropauto function not properly documented
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202205@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 working +Summary: imagecropauto function not properly documented -Status: Feedback +Status: Verified Type: Bug Package: GD related Operating System: windows PHP Version: 5.5.22 Assigned To: cmb Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 (#202205) next »