ID: 12780 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: GD related Operating System: Windows 2000 PHP Version: 4.0.6 New Comment:
The following was in the user manual. Could someone please apply this fix for the next release? [EMAIL PROTECTED] 01-Oct-2001 03:42 As reported above, there is a bug in this function which basically means it ignores the srcX and srcY parameters. The fix is really easy, assuming you don't mind recompiling GD. You need to change the lines in gd.c that read: p = gdImageGetTrueColorPixel ( src, (int) sx, (int) sy; to read: p = gdImageGetTrueColorPixel ( src, (int) sx + srcX, (int) sy + srcY; Previous Comments: ------------------------------------------------------------------------ [2001-08-31 06:42:42] [EMAIL PROTECTED] [User input: [EMAIL PROTECTED]] I have experienced an issue identical to bug #12780, on a Linux machine running RedHat 7.1, Apache 1.3.20, PHP 4.0.6, and GD 2.0.1. The original bug was running under Win2000. ------------------------------------------------------------------------ [2001-08-15 22:31:16] [EMAIL PROTECTED] The Source X and Y parameters are ignored by the function ImageCopyResampled. This may be a bug with the GD 2.0.1 library itself, since an examination of gd.c lines 1960-2085 reveal no significant reference to these parameters. My e-mail to the developers is getting bounced, so I turn to you. I used the setup program for Windows to install PHP 4.0.6 on a fresh Windows 2000 machine, but I believe the problem is platform independant. Here's how to reproduce the bug: 1: Create a 200 x 200 JPEG image named "grid.jpg". Divide it into four colored sqares of equal size, just for the demonstration. 2: Create an HTML page with the following content: <p> <img src="imgTest.php?src_w=100&src_h=100" alt="(src_w=100, src_h=100)"><br> <img src="imgTest.php?src_w=100&src_h=100&src_x=100" alt="(src_w=100, src_h=100, src_x=100)"><br> <img src="imgTest.php?src_w=100&src_h=100&src_y=100" alt="(src_w=100, src_h=100, src_y=100)"><br> <img src="imgTest.php?src_w=100&src_h=100&src_x=100&src_y=100" alt="(src_w=100, src_h=100, src_x=100, src_y=100)"><br> </p> <p> <img src="imgTest.php?mode=sample&src_w=100&src_h=100" alt="(src_w=100, src_h=100)"><br> <img src="imgTest.php?mode=sample&src_w=100&src_h=100&src_x=100" alt="(src_w=100, src_h=100, src_x=100)"><br> <img src="imgTest.php?mode=sample&src_w=100&src_h=100&src_y=100" alt="(src_w=100, src_h=100, src_y=100)"><br> <img src="imgTest.php?mode=sample&src_w=100&src_h=100&src_x=100&src_y=100" alt="(src_w=100, src_h=100, src_x=100, src_y=100)"><br> </p> 3: Create a PHP page named "imgTest.php" with the following content: <?php // test of the GD functions... $src_img = ImageCreateFromJPEG("./grid.jpg"); if (empty($dest_x)) $dest_x = 0; if (empty($dest_y)) $dest_y = 0; if (empty($dest_w)) $dest_w = 100; if (empty($dest_h)) $dest_h = 100; if (empty($src_x)) $src_x = 0; if (empty($src_y)) $src_y = 0; if (empty($src_w)) $src_w = ImageSX($src_img); if (empty($src_h)) $src_h = ImageSY($src_img); $dst_img = ImageCreateTrueColor($dest_w, $dest_h); if ($mode == "sample") { ImageCopyResampled( $dst_img, $src_img, $dest_x, $dest_y, $src_x, $src_y, $dest_w, $dest_h, $src_w, $src_h); } else { ImageCopyResized( $dst_img, $src_img, $dest_x, $dest_y, $src_x, $src_y, $dest_w, $dest_h, $src_w, $src_h); } header("Content-type: image/JPEG"); ImageJPEG($dst_img); ImageDestroy($dst_img); ImageDestroy($src_img); ?> The result is that the bottom group of squares will all be from the upper left corner, while the top group of squares will be separate corners. This shows that the functions are not interchangable. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=12780&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]