php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24155 imagerotate fail to copy entire source image
Submitted: 2003-06-12 12:23 UTC Modified: 2003-06-12 14:33 UTC
From: tom at gksystems dot com Assigned: iliaa (profile)
Status: Closed Package: GD related
PHP Version: 4.3.2 OS: all
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tom at gksystems dot com
New email:
PHP Version: OS:

 

 [2003-06-12 12:23 UTC] tom at gksystems dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-12 14:33 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 09:01:27 2024 UTC