Draw a text over an image using PostScript Type1 fonts in PHP

Description

The following code shows how to draw a text over an image using PostScript Type1 fonts.

Example


<?php//ww w. j a va 2  s .  co  m
// Create image handle
$im = imagecreatetruecolor(200, 200);

// Allocate colors
$black = imagecolorallocate($im, 0, 0, 0);
$white = imagecolorallocate($im, 255, 255, 255);

// Load the PostScript Font
$font = imagepsloadfont('font.pfm');

// Write the font to the image
imagepstext($im, 'Sample text is simple', $font, 12, $black, $white, 50, 50);

// Output and free memory
header('Content-type: image/png');

imagepng($im);
imagedestroy($im);
?>




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text