Applying TrueType Fonts to an Image : imagettfbbox « Graphics Image « PHP






Applying TrueType Fonts to an Image

 
<?php
    $animage = imagecreatefromjpeg ("myImage.jpg")){

    $black = imagecolorallocate ($animage, 0, 0, 0);

    $topleftx = 10;
    $toplefty = 30;
    $bottomrightx = 70;
    $bottomrighty = 90;
      
    $verdana = "C:\WINDOWS\Fonts\verdana.ttf";

    $dimensions = imagettfbbox (14,0,$verdana, $_GET['whattosay']);
    $strlen = 100;

    $xcoord = 200;
      
    imagettftext($animage, 14, 0, $xcoord, 60, $black, $verdana, $_GET['whattosay']);
      
    imagejpeg ($animage);

    header ("Content-type: image/jpeg");
      
    imagedestroy ($animage);
?>
  
  








Related examples in the same category

1.The eight elements in the array returned by imagettfbox( )
2.Using the imagettfbbox() Function