// ENTER URL
$image = 'redblue.jpeg';
//ENTER DEGREES
$degrees = 45;
// SET FOR JPEG BUT CAN BE GIF OR PNG
header('Content-type: image/jpeg') ;
// Create the canvas
$source = imagecreatefromjpeg($image) ;
// Rotates the image
$rotate = imagerotate($source, $degrees, 0) ;
imagejpeg($rotate) ;
?>