0

Title says JPEG. But I tried PNG. It didn't work. GD supports imagerotate function.

 if (function_exists('imagerotate')) { 
     echo "test";
 }

It outputs the word test. So i assume I have imagerotate function.

$im = imagecreatetruecolor($width + 10, $height + 10);
...

I did some image porcess. I can see the processed image without any problem. But i want to rotate the final image. So i did the following.

 imagerotate($im,180,0);
 imagepng($im,$png,9);
 imagedestroy($im);

But I am still getting the image without rotation. I even just tried to rotate a image without doing any process. It didn't work too.

j0k
  • 22,600
  • 28
  • 79
  • 90
Mahesh
  • 1,503
  • 3
  • 22
  • 33

1 Answers1

3

You need to assign the rotated image to another variable before create the png.

$rotatedImage = imagerotate($im,180,0);
 imagepng($rotatedImage,$png,9);
 imagedestroy($rotatedImage);
Oras
  • 1,036
  • 1
  • 12
  • 18