note 113960 added to function.imageaffine
| From: | abcated48dotcom | Date: | Sun, 22 Dec 2013 17:52:03 +0000 |
| Subject: | note 113960 added to function.imageaffine | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198002@lists.php.net to get a copy of this message | ||
Here is an example, which performs a specific processing, every time it is executed:
<?php
if (!function_exists('imageaffine'))
{
echo 'FUNCTION NOT DEFINED IN THIS VERSION OF PHP';
exit;
}
$base_img = 'affine.png';
$tgt_img1 = 'triangle1.png';
$tgt_img2 = 'triangle2.png';
$arr_affine = [
[ 1, 0, 0, 1, 0, 0 ],
[ 1, 0, 0, 1, 150, 0 ],
[ 1.2, 0, 0, 0.6, 0, 0 ],
[ -1.2, 0, 0, -0.6, 0, 0 ],
[ 1, 2, 0, 1, 0, 0 ],
[ 2, 1, 0, 1, 0, 0 ],
[ cos(15), sin(15), -sin(15), cos(15), 0, 0 ],
[ cos(15), -sin(15), sin(15), cos(15), 0, 0 ]
];
$RSR_base = imagecreatetruecolor(400, 300);
$w = imagesx($RSR_base);
$h = imagesy($RSR_base);
$arr_clip = [ 'x' => 0, 'y' => 0, 'width' => $w,
'height' => $h ];
$fillcolor = imagecolorallocate($RSR_base, 0, 0, 0);
imagefill($RSR_base, 10,10, $fillcolor);
imagepng($RSR_base, $base_img);
$drawcolor = imagecolorallocate($RSR_base, 255, 0, 0);
$triangle = [ 50, 50, 50, 150, 200, 150 ];
$points = 3;
imageantialias($RSR_base, 1);
$drawtriangle = imagefilledpolygon($RSR_base, $triangle, $points, $drawcolor);
imagepng($RSR_base, $tgt_img1);
$select = mt_rand(0, 7);
$RSRaff2 = imageaffine($RSR_base, $arr_affine[$select], $arr_clip);
imagepng($RSRaff2, $tgt_img2, 9);
?>
SUPPORT IMAGE<br><br>
<img src="<?php echo $base_img; ?>" alt="*" /><br><br>
BASE IMAGE<br><br>
<img src="<?php echo $tgt_img1; ?>" alt="*" /><br><br>
RESULT IMAGE<br><br>
<img src="<?php echo $tgt_img2; ?>" alt="*" />
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.imageaffine.php
Edit -- https://master.php.net/note/edit/113960
Del: integrated -- https://master.php.net/note/delete/113960/integrated
Del: useless -- https://master.php.net/note/delete/113960/useless
Del: bad code -- https://master.php.net/note/delete/113960/bad+code
Del: spam -- https://master.php.net/note/delete/113960/spam
Del: non-english -- https://master.php.net/note/delete/113960/non-english
Del: in docs -- https://master.php.net/note/delete/113960/in+docs
Del: other reasons-- https://master.php.net/note/delete/113960
Reject -- https://master.php.net/note/reject/113960
Search -- https://master.php.net/manage/user-notes.php