note 121937 added to function.imagerotate
| From: | shaun at slickdesign dot com dot au | Date: | Wed, 29 Nov 2017 07:31:14 +0000 |
| Subject: | note 121937 added to function.imagerotate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209245@lists.php.net to get a copy of this message | ||
The angle in imagerotate() is the number of degrees to rotate the image anti-clockwise, but while it
may seem natural to use '-90' to turn an image 90 degrees clockwise, the end result may
appear on a slight angle, and may cause the rotated image to appear slightly blurred with a
background or border. Excessively large angles may also present sampling issues.
The easiest way to prevent these, is to ensure all angles are between 0 and 360.
<?php
while ( $angle < 0 ) { $angle += 360; }
while ( $angle >= 360 ) { $angle -= 360; }
$rotated = imagerotate( $image, $angle, $color );
?>
----
Server IP: 208.43.231.9
Probable Submitter: 211.26.34.121
----
Manual Page -- http://php.net/manual/en/function.imagerotate.php
Edit -- https://master.php.net/note/edit/121937
Del: integrated -- https://master.php.net/note/delete/121937/integrated
Del: useless -- https://master.php.net/note/delete/121937/useless
Del: bad code -- https://master.php.net/note/delete/121937/bad+code
Del: spam -- https://master.php.net/note/delete/121937/spam
Del: non-english -- https://master.php.net/note/delete/121937/non-english
Del: in docs -- https://master.php.net/note/delete/121937/in+docs
Del: other reasons-- https://master.php.net/note/delete/121937
Reject -- https://master.php.net/note/reject/121937
Search -- https://master.php.net/manage/user-notes.php