note 107109 added to function.imagearc
| From: | chandlerklebs at gmail dot com | Date: | Sun, 08 Jan 2012 06:24:42 +0000 |
| Subject: | note 107109 added to function.imagearc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185454@lists.php.net to get a copy of this message | ||
This is an example script I wrote for myself to help me learn how to used the imagearc functions.
Maybe if will also help others.
<?php
//example PHP script of imagearc functions
$image_width=360;$image_height=360;
$img = imagecreatetruecolor($image_width,$image_height); //make image variable
//create a background color by making a filled rectangle
$color = imagecolorallocate($img,255,255,255);
imagefilledrectangle($img,0,0,$image_width,$image_height,$color);
$r=$image_width/2 - $image_width/32 ; //radius
$cx=$image_width/2;
$cy=$image_height/2;
$color = imagecolorallocate($img,0,0,0);
imagearc($img, $cx, $cy, $r*2, $r*2, 0, 360, $color); //regular outlines arc
imagefilledarc($img, $cx, $cy, $r*1, $r*1, 0, 90, $color,IMG_ARC_CHORD); //filled triangle with
chord of circle
imagefilledarc($img, $cx, $cy, $r*1, $r*1, 180, 270, $color,IMG_ARC_PIE); //pie slice
$font_number=5; //can use built in fonts numbered 1 to 5
$string="Hello world!";
imagestring($img, $font_number, $cx-(imagefontwidth($font_number)*strlen($string))/2, $cy-120,
$string, $color);
header("Content-type: image/png");
imagepng($img);// output image in the browser
$filename="imagearc";
imagepng($img,"./frames/$filename.png",9); //make highly compressed png
imagedestroy($img);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 70.252.128.114
----
Manual Page -- http://www.php.net/manual/en/function.imagearc.php
Edit -- https://master.php.net/note/edit/107109
Del: integrated -- https://master.php.net/note/delete/107109/integrated
Del: useless -- https://master.php.net/note/delete/107109/useless
Del: bad code -- https://master.php.net/note/delete/107109/bad+code
Del: spam -- https://master.php.net/note/delete/107109/spam
Del: non-english -- https://master.php.net/note/delete/107109/non-english
Del: in docs -- https://master.php.net/note/delete/107109/in+docs
Del: other reasons-- https://master.php.net/note/delete/107109
Reject -- https://master.php.net/note/reject/107109
Search -- https://master.php.net/manage/user-notes.php