Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: max(six, four)?
(Example: nine)

The Note You're Voting On

shaun at slickdesign dot com dot au
7 years ago
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 );
?>

<< Back to user notes page

To Top