From:             tom at gksystems dot com
Operating system: all
PHP version:      4.3.2
PHP Bug Type:     GD related
Bug description:  imagerotate fail to copy entire source image

Description:
------------
When rotating an image which is taller-than-wide through an angle > 225
and <= 315 degrees, only a square portion of the image is copied. The
remainder is black.

ext/libgd/gd.c has a bug in gdImageRotate270:

  for (uY = 0; uY<src->sx; uY++) {
    for (uX = 0; uX<src->sx; uX++) {

uY and uX both have a range of src->sx, so only a square region is copied.
The first line should be:

  for (uY = 0; uY<src->sy; uY++) {


Reproduce code:
---------------
<script language="PHP">
// June 12, 2003  Tom Robinson
// Display a 30x50 yellow rectangle, rotated 270 degrees CCW.
$im = ImageCreateTrueColor(30,50);
imagefill($im,0,0,16777215-255); 
$im = imagerotate($im,270,255);
header("Content-type: image/png");
imagepng($im);
</script>


Expected result:
----------------
See a yellow rectangle.

Actual result:
--------------
See a rectangle with a yellow square and the rest is black.

-- 
Edit bug report at http://bugs.php.net/?id=24155&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24155&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24155&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24155&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24155&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24155&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24155&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24155&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24155&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24155&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24155&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24155&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24155&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24155&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24155&r=gnused

Reply via email to