note 39052 added to function.imagerotate
| From: | MNM at rn2 dot php dot net | Date: | Thu, 15 Jan 2004 15:09:38 +0000 |
| Subject: | note 39052 added to function.imagerotate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-63621@lists.php.net to get a copy of this message | ||
The center of rotation is the center of the image, and the rotated image is scaled down so that the
whole rotated image fits in the destination image, ie the edges are not clipped.
<?php
header("Content-type: image/png");
$w = 51;
$h = 81;
$angle = 10.0;
$im = imagecreate($w, $h);
$bg = imagecolorallocate($im, 240, 240, 240);
$fg = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, $w, $h, $bg);
for ($x = 0; $x < $w; $x = $x + 10)
imageline($im, $x, 0, $x, $h, $fg);
for ($y = 0; $y < $h; $y = $y + 10)
imageline($im, 0, $y, $w, $y, $fg);
$rotatim = imagerotate($im, $angle, $bg);
// imagepng($im);
imagepng($rotatim);
imagedestroy($im); imagedestroy($rotatim);
?>
----
Manual Page -- http://www.php.net/manual/en/function.imagerotate.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39052
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39052&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39052&report=yes
Search -- http://master.php.net/manage/user-notes.php