Drawing a Square and a string : Draw String « Graphics Image « PHP






Drawing a Square and a string

<?php
     header ("Content-type: image/png");
   
     $im = ImageCreate (150, 150);
     $grey = ImageColorAllocate ($im, 230, 230, 230); // background color
     $black = ImageColorAllocate ($im, 0, 0, 0);
   
     ImageRectangle($im, 40, 40, 140, 140, $black);
     ImageString($im, 3, 5, 5, "Figure 18.3: Square", $black);
     ImagePng ($im);
     ImageDestroy ($im);
?>
           
       








Related examples in the same category

1.Paint string value with different colors and position
2.Draw char with color
3.Draw string and fill rectangle
4.Using a Bounding Box to Center Text