note 39052 deleted from function.imagerotate by aidan
| From: | aidan@php.net | Date: | Mon, 04 Oct 2004 07:05:38 +0000 |
| Subject: | note 39052 deleted from function.imagerotate by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77885@lists.php.net to get a copy of this message | ||
Note Submitter: MNM
----
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);
?>