note 121935 added to function.imagecrop
| From: | shaun at slickdesign dot com dot au | Date: | Wed, 29 Nov 2017 06:40:16 +0000 |
| Subject: | note 121935 added to function.imagecrop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209243@lists.php.net to get a copy of this message | ||
Use imagecopyresampled to crop your image instead, and it should work correctly in PHP 5.5+ without
any black lines.
<?php
// Desired function call.
$cropped = imagecrop( $image, array( 'x' => $x, 'y' => $y,
'width' => $width, 'height' => $height ) );
// Equivalent function which works in both PHP pre 5.6.12 and 5.6.12+.
$cropped = imagecreatetruecolor( $width, $height );
imagecopyresampled( $cropped, $image, 0, 0, $x, $y, $width, $height, $width, $height );
?>
----
Server IP: 208.43.231.9
Probable Submitter: 211.26.34.121
----
Manual Page -- http://php.net/manual/en/function.imagecrop.php
Edit -- https://master.php.net/note/edit/121935
Del: integrated -- https://master.php.net/note/delete/121935/integrated
Del: useless -- https://master.php.net/note/delete/121935/useless
Del: bad code -- https://master.php.net/note/delete/121935/bad+code
Del: spam -- https://master.php.net/note/delete/121935/spam
Del: non-english -- https://master.php.net/note/delete/121935/non-english
Del: in docs -- https://master.php.net/note/delete/121935/in+docs
Del: other reasons-- https://master.php.net/note/delete/121935
Reject -- https://master.php.net/note/reject/121935
Search -- https://master.php.net/manage/user-notes.php