This should be a replacement for imagecrop() (no error ...):
function mycrop($src, array $rect) { $dest = imagecreatetruecolor($rect['width'], $rect['height']); imagecopy( $dest, $src, 0, 0, $rect['x'], $rect['y'], $rect['width'], $rect['height'] ); return $dest; }
Using:
$img = mycrop($img, ['x' => 10, 'y' => 10, 'width' => 100, 'height' => 100]);
Note that the error seems to be fixed in PHP 5.6.12 .
source share