Trying to do my first “image rotation” and not having success. Got these pics from a friend and one of them needs to be turned 90 degrees. I found this logic online and am trying to make it work.
Went thru the process of ensuring that I had enough memory and am doing error checking as I progress but the end result, a second image file, is not rotated. Here it is:
[code]
$srcname = $root.$filename;
echo “Reading image<br>$srcname<br>”;
$source = imagecreatefromjpeg($srcname);
// Rotate
$rotate = imagerotate($source, $degrees, 0);
echo “Rotated $degrees degrees<br>”;
if (imagejpeg($source, $root.$savename))
echo “Saved as:<br>$root$savename”;
else
echo “Could not save new image<br>$root$savename<br>”;
// Free the memory
imagedestroy($source);
imagedestroy($rotate);
exit();
The filename shows up correctly in my echos and the degrees is set to 270 (docs tell me that the rotate is anti-clockwise so while I only need to go 90 to the right I am going 270 to the left). The save image name is also correct but when I view the new image it is not rotated.