note 13055 modified in function.imagepstext by felipe
| From: | felipe@php.net | Date: | Wed, 23 Jul 2008 13:05:14 +0000 |
| Subject: | note 13055 modified in function.imagepstext by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142602@lists.php.net to get a copy of this message | ||
One other thing... variables. It is important to convert variables to the proper type before they
hit this function. In this respect, ImageTtfText is easier to work with. IE, if you pass a font size
from one page to the next, via GPC, it becomes a string type. Sooo... use IntVal() to convert it to
an integer type that ImagePsText can digest. In addition you must convert HTML special characters or
use chr() to represent special characters. ImagePsFont will not decode  to represent a space,
use Chr(32) or a space:
<?php
$fontsize=IntVal($fontsize);
$font=ImagePsLoadFont("fonts/IntR.pfb");
ImagePsText($im, $textstring, $font, $fontsize, $textcolor, $background, 0,
$fontsize,'','','',16); //note antialias is set
ImagePsFreeFont($font);
?>
thx,
Neil
--was--
One other thing... variables. It is important to convert variables to the proper type before they
hit this function. In this respect, ImageTtfText is easier to work with. IE, if you pass a font size
from one page to the next, via GPC, it becomes a string type. Sooo... use IntVal() to convert it to
an integer type that ImagePsText can digest. In addition you must convert HTML special characters or
use chr() to represent special characters. ImagePsFont will not decode to represent a
space, use Chr(32) or a space:
$fontsize=IntVal($fontsize);
$font=ImagePsLoadFont("fonts/IntR.pfb");
ImagePsText($im, $textstring, $font, $fontsize, $textcolor, $background, 0,
$fontsize,'','','',16); //note antialias is set
ImagePsFreeFont($font);
thx,
Neil
http://php.net/manual/en/function.imagepstext.php