Create TrueType Font Bounding Box in PHP

Description

The following code shows how to create TrueType Font Bounding Box.

Example


<?php//from  w w  w  . jav  a  2 s .  c  o m
     header ("Content-type: image/png");
   
     $font_size = 15;
     $im = ImageCreate (300, 500);
     $grey = ImageColorAllocate ($im, 230, 230, 230);
     $black = ImageColorAllocate ($im, 0, 0, 0);
     $bbox = ImageTTFBBox($font_size, 0, "ARIALBD.TTF", "Bounding Box!");
   
     for($i = 0; $i < 7; $i++){
          ImageTTFText($im, $font_size, 0, 10, ($i * ($font_size * 2)) + 25,$black, "ARIALBD.TTF", "\$bbox[$i] = $bbox[$i]");
     }
     ImagePng ($im);
     ImageDestroy ($im);
?>




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text