PHP Warning: imagettftext() expects parameter 2 to be double

From: Date: Mon, 05 Dec 2005 17:08:19 +0000
Subject: PHP Warning: imagettftext() expects parameter 2 to be double
Groups: php.general 
Request: Send a blank email to php-general+get-226885@lists.php.net to get a copy of this message
Hi there, I have been using the GD functions from PHP5.0 on Mac OS X. I have a simple script that creates a PNG image with text on the image using fonts using FreeType 2. I am trying to use the imagettftext() function within a foreach loop ­ but I get the following error: PHP Warning: imagettftext() expects parameter 2 to be double The code is as follows: $font['type']="./fonts/font.ttf²; $font['color']=imageColorAllocate($card['png'],$font['hexcolor']['r'],$font[ 'hexcolor']['g'],$font['hexcolor']['b']); imageFill($card['png'],0,0,$card['color']); foreach ($xml->textblock as $text) { $fontsize=$text->fontsize; $fontangle=$text->fontangle; $fontxpos=$text->fontxpos; $fontypos=$text->fontypos; $text=$text->text; imagettftext($image['png'],$fontsize,$fontangle,$fontxpos,$fontypos,$font['c olor'],$font['type'],$text); } It works fine if I add just one line outside of the loop ­ but as soon as its within the loop it errors. Cheers, James

« previous php.general (#226885) next »