note 121935 deleted from function.imagecrop by cmb

From: Date: Fri, 09 Oct 2020 12:33:26 +0000
Subject: note 121935 deleted from function.imagecrop by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215559@lists.php.net to get a copy of this message
Note Submitter: shaun at slickdesign dot com dot au ---- 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 ); ?>

« previous php.notes (#215559) next »