note 85187 added to function.imagerotate
| From: | cbl25 at osu1 dot php dot net | Date: | Tue, 19 Aug 2008 14:29:33 +0000 |
| Subject: | note 85187 added to function.imagerotate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143632@lists.php.net to get a copy of this message | ||
Here is a simple function to rotate a non-square image 90 degrees clockwise.
function rotateImage($imageResource)
{
$width = imagesx($imageResource);
$height = imagesy($imageResource);
$side = $width > $height ? $width : $height;
$squareImage = imagecreatetruecolor($side, $side);
imagecopy($squareImage,$imageResource,0,0,0,0,$width,$height);
$squareImage = imagerotate($squareImage,270,0,-1);
$imageResource = imagecreatetruecolor($height, $width);
$x = $height > $width ? 0 : $side - $height;
imagecopy($imageResource,$squareImage,0,0,$x,0,$height,$width);
return $imageResource;
}
----
Server IP: 69.147.83.197
Probable Submitter: 67.128.33.98
----
Manual Page -- http://www.php.net/manual/en/function.imagerotate.php
Edit -- https://master.php.net/note/edit/85187
Del: integrated -- https://master.php.net/note/delete/85187/integrated
Del: useless -- https://master.php.net/note/delete/85187/useless
Del: bad code -- https://master.php.net/note/delete/85187/bad+code
Del: spam -- https://master.php.net/note/delete/85187/spam
Del: non-english -- https://master.php.net/note/delete/85187/non-english
Del: in docs -- https://master.php.net/note/delete/85187/in+docs
Del: other reasons-- https://master.php.net/note/delete/85187
Reject -- https://master.php.net/note/reject/85187
Search -- https://master.php.net/manage/user-notes.php