I copied the imagerotate function straight off the php.net manual:
// File and rotation
$filename = ‘test.jpg’;
$degrees = 180;
// Content type
$source = imagecreatefromjpeg($filename);
$rotate = imagerotate($source, $degrees, 0);
But I find if it is not the first thing sent to the browser the return is machine code characters. So I tried to save $rotate to a new file name, which I prefer,( since once rotated by the client they should stay rotated) but I can’t save it as a file either. I guess you need to send the header tag, but how do you do that in the middle of the page? I would prefer to write the rotated image to a new file or overwrite the old one.