note 109432 added to function.imagerotate
| From: | meisterix at gmx dot com | Date: | Mon, 16 Jul 2012 21:24:08 +0000 |
| Subject: | note 109432 added to function.imagerotate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-189252@lists.php.net to get a copy of this message | ||
After some INet searches and personal try-and-failures I succeed to rotate PNG images with
preserving alpha channel transparency (semi transparency).
<?php
$filename = 'YourFile.png';
$rotang = 20; // Rotation angle
$source = imagecreatefrompng($filename) or die('Error opening file '.$filename);
imagealphablending($source, false);
imagesavealpha($source, true);
$rotation = imagerotate($source, $rotang, imageColorAllocateAlpha($source, 0, 0, 0, 127));
imagealphablending($rotation, false);
imagesavealpha($rotation, true);
header('Content-type: image/png');
imagepng($rotation);
imagedestroy($source);
imagedestroy($rotation);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 78.83.68.10
----
Manual Page -- http://www.php.net/manual/en/function.imagerotate.php
Edit -- https://master.php.net/note/edit/109432
Del: integrated -- https://master.php.net/note/delete/109432/integrated
Del: useless -- https://master.php.net/note/delete/109432/useless
Del: bad code -- https://master.php.net/note/delete/109432/bad+code
Del: spam -- https://master.php.net/note/delete/109432/spam
Del: non-english -- https://master.php.net/note/delete/109432/non-english
Del: in docs -- https://master.php.net/note/delete/109432/in+docs
Del: other reasons-- https://master.php.net/note/delete/109432
Reject -- https://master.php.net/note/reject/109432
Search -- https://master.php.net/manage/user-notes.php