working code:

<?php
header("Content-type: image/png");
$im = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>

not so working code:

<?php
header("Content-type: image/png");
$im = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
$font = 'font.ttc';
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color, $font);
imagepng($im);
imagedestroy($im);
?>

can GD NOT use ttc font types?

    I also tried imagettftext

    <?php
    header("Content-type: image/png");
    $im = @imagecreate(110, 20)
    or die("Cannot Initialize new GD image stream");
    $background_color = imagecolorallocate($im, 0, 0, 0);
    $text_color = imagecolorallocate($im, 233, 14, 91);
    $font = 'font.ttc';
    imagettftext($im, 1, 0, 5, 5, "A Simple Text String", $text_color, $font);
    imagepng($im);
    imagedestroy($im);
    ?>
    

      hmmm... leave it to php to make a similar procedure code differently

      imagettftext($im, 20, 0, 5, 5, $text_color, $font, "A Simple Text String");
      

      seems to work roughly ATM

      if i have two fonts in my TTC file... any idea how to specify one over another?

        Write a Reply...