note 35902 rejected from function.imagerotate by vincent
| From: | vincent@php.net | Date: | Thu, 18 Sep 2003 17:00:10 +0000 |
| Subject: | note 35902 rejected from function.imagerotate by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56716@lists.php.net to get a copy of this message | ||
Note Submitter: troxa@troxa.dk
----
Hi, i have tried to use this function to rotate an image 270 degrees, but it doesn't rotate the
image correctly. But if i use the function 3 times 90 degrees which will make it 270 degrees then it
works.
Can someone tell me why the angle 270 doens't work ?
<?php
Header("Content-type: image/jpeg");
$filename = "filename.jpg";
$img_size = getImageSize($filename);
$x = $img_size[0];
$y = $img_size[1];
if ($x > $y)
{
$newd = $x;
}
else
{
$newd = $y;
}
$src_img = ImageCreateFromJPEG($filename);
$dst_img = ImageCreateTrueColor($newd,$newd);
$final_img = ImageCreateTrueColor($y,$x);
ImageCopyResampled($dst_img,$src_img,0,0,0,0,$x,$y,$x,$y);
$degrees = "270";
$rotated_img = ImageRotate($dst_img,$degrees,0);
ImageCopyResampled($final_img,$rotated_img,0,0,0,0,$y,$x,$y,$x);
ImageJPEG($final_img);
?>