|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-03-04 12:07 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 22 23:00:01 2025 UTC |
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.