ID:               38627
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         GD related
 Operating System: Gentoo
 PHP Version:      5.2.0RC2
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------

[2006-08-28 14:36:50] [EMAIL PROTECTED]

Description:
------------
1. Allocate an image resource $a.
2. Resample (scale) $a to a second resource $b.
3. Destroy $a.
4. Assign $a = $b.
5. Resample (crop) $a to a third resource $c.
6. Destroy $a.
7. Assign $a = $c.

For step 5 the initially allocated resource is used instead of the
originally resampled one.


Reproduce code:
---------------
<?php

// http://schlitt.info/misc/gd/test_original.jpg
$res_1 = imagecreatefromjpeg( "test_original.jpg" );

$res_2 = imagecreatetruecolor( 200, 151 );

// Scale the image to 200x151
$res = imagecopyresampled(
    $res_2,     // dst_img
    $res_1,     // res_img
    0,          // dst_x
    0,          // dst_y
    0,          // src_x
    0,          // src_y
    200,        // dst_width
    151,        // dst_height
    150,        // src_width
    113         // src_height
);

// http://schlitt.info/misc/gd/test_scaled.jpg
imagejpeg( $res_2, "test_scaled.jpg" );

imagedestroy( $res_1 );

$res_1 = $res_2;

$res_3 = imagecreatetruecolor( 100, 100 );

// Crop the image to 100x100 selecting 50x150+50x150
$res = imagecopyresampled(
    $res_3,    // dst_img
    $res_1,    // res_img
    0,         // dst_x
    0,         // dst_y
    50,        // src_x
    50,        // src_y
    100,       // dst_width
    100,       // dst_height
    150,       // src_width
    150        // src_height
);

// http://schlitt.info/misc/gd/test_cropped.jpg
imagejpeg( $res_3, "test_cropped.jpg" );

imagedestroy( $res_1 );

$res_1 = $res_3;

// http://schlitt.info/misc/gd/test_final.jpg
imagejpeg( $res_1, "test_final.jpg" );

?>

Expected result:
----------------
test_cropped.jpg should be a cropped version of test_scaled.php

Actual result:
--------------
test_cropped.jpg is a cropped version of test_original.jpg


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38627&edit=1

Reply via email to