Draw string and fill rectangle : Draw String « Graphics Image « PHP






Draw string and fill rectangle


<?php
  header("Content-type: image/gif");
  $imgcord = imagecreate(500,500);
  
  $blue = imagecolorallocate($imgcord, 0,0,255);
  $red = imagecolorallocate($imgcord, 255,0,0);

  ImageRectangle($imgcord, 175,165, 200,225, $blue);
  ImageFill($imgcord, 0,0, $red);
  ImageString($imgcord, 3,170, 220,"www.java2s.com", $blue);
  ImagePNG($imgcord);
  ImageDestroy($imgcord);
?>
           
       








Related examples in the same category

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