Rubblewebs

THESE CODES ARE PROVIDED FOR AN EXAMPLE OF HOW TO USE IMAGEMAGICK WITH PHP. CARE SHOULD BE TAKEN WHEN ACCEPTING USER INPUT.

I TAKE NO RESPONSABILTY FOR ANY PROBLEMS THAT MAY OCCURE WHEN USING ANY OF THIS CODE.

IT IS UP TO YOU TO SECURE THE CODE AND VALIDATE USER INPUT.

Polyline

Example of using a polyline

Polyline example
 
$cmd = "-size 100x100 xc:none -fill green -stroke black -strokewidth 1 ".
" -draw \" polyline 85,90 15,90 35,75 20,75 40,60 25,60 40,50 30,50 50,30 70,50 60,50 75,60 60,60 80,75 65,75 85,90 \" ".
" -fill brown -draw \"rectangle 55,99 45,90 \" ".
" -fill gold -draw \"circle 50,28 50,23 \" ".
" -fill red -draw \"circle 15,90 15,88 \" -draw \"circle 85,90 85,88 \" ".
" -fill blue -draw \"circle 20,75 20,73 \" -draw \"circle 80,75 80,73 \" ".
" -fill red -draw \"circle 25,60 25,58 \" -draw \"circle 75,60 75,58 \" ".
" -fill blue -draw \"circle 30,50 30,48 \" -draw \"circle 70,50 70,48 \" ";

exec("convert $cmd polyline.png");

Create a canvas 100x100 with a transparent background; draws the outline of the tree first and fills it green; draws the brown rectangle for the trunk and lastly draws the circle at the top of the tree then the other circles.


Back