Rotate an image 180 degrees - upside down in PHP
Description
The following code shows how to rotate an image 180 degrees - upside down.
Example
<?php// ww w . j av a 2 s .com
// File and rotation
$filename = 'test.jpg';
$degrees = 180;
// Content type
header('Content-type: image/jpeg');
// Load
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, $degrees, 0);
// Output
imagejpeg($rotate);
// Free the memory
imagedestroy($source);
imagedestroy($rotate);
?>
The code above generates the following result.