note 41314 deleted from function.imagecopyresampled by aidan
| From: | aidan@php.net | Date: | Mon, 04 Oct 2004 09:43:21 +0000 |
| Subject: | note 41314 deleted from function.imagecopyresampled by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77946@lists.php.net to get a copy of this message | ||
Note Submitter: nicko2k at ennkayohh dot net
----
The PHP/GD2 combo included with Debian Woody still seems to ignore the srcX and srcY, so I whipped
up this drop-in replacement to get around it:
<?php
function _imagecopyresampled( $dst_im, $src_im, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW,
$srcH) {
// to fix gd2 not using the srcX and srcY with imagecopyresampled :X
$image = imagecreatetruecolor($srcW, $srcH);
imagecopy($image, $src_im, 0, 0, $srcX, $srcY, $srcW, $srcH);
imagecopyresampled( $dst_im, $image, $dstX, $dstY, 0, 0, $dstW, $dstH, $srcW, $srcH);
imagedestroy($image);
}
?>