note 96563 added to function.imagerotate
| From: | kmrohe at letsco dot de | Date: | Fri, 05 Mar 2010 11:00:50 +0000 |
| Subject: | note 96563 added to function.imagerotate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166695@lists.php.net to get a copy of this message | ||
As an alternative to the GD rotateImage() function, this is an easy way to rotate images by 90
degrees ccw *without* loosing transparency:
<?php
function rotateImage($image) {
$width = imagesx($image);
$height = imagesy($image);
$newImage= imagecreatetruecolor($height, $width);
imagealphablending($newImage, false);
imagesavealpha($newImage, true);
for($w=0; $w<$width; $w++)
for($h=0; $h<$height; $h++) {
$ref = imagecolorat($image, $w, $h);
imagesetpixel($newImage, $h, ($width-1)-$w, $ref);
}
return $newImage;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 79.247.89.43
----
Manual Page -- http://www.php.net/manual/en/function.imagerotate.php
Edit -- https://master.php.net/note/edit/96563
Del: integrated -- https://master.php.net/note/delete/96563/integrated
Del: useless -- https://master.php.net/note/delete/96563/useless
Del: bad code -- https://master.php.net/note/delete/96563/bad+code
Del: spam -- https://master.php.net/note/delete/96563/spam
Del: non-english -- https://master.php.net/note/delete/96563/non-english
Del: in docs -- https://master.php.net/note/delete/96563/in+docs
Del: other reasons-- https://master.php.net/note/delete/96563
Reject -- https://master.php.net/note/reject/96563
Search -- https://master.php.net/manage/user-notes.php