<?php
// File and rotation
$filename = 'rotate.jpg';
$degrees = 90;

// Content type
header('Content-type: image/jpeg');

// Load
$source = imagecreatefromjpeg($filename);

// Rotate
$rotate = imagerotate($source, $degrees, 0);

#// Output
#imagejpeg($rotate);
imagejpeg($source);
?>

