Reply to Re: [PHP] PHP Warning: imagettftext() expects parameter 2 to be double

Your name:

Reply:


Posted by Jochem Maas on 12/07/05 13:58

James wrote:
> 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

what does paramter 2 contain in each case? var_dump(), print_r(), echo ?!?

>
> 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;

try var_dump($text); or print_r($text); to see what you have
(if its an XML node object - dump $fontsize, $fontxpos instead!!!)

> 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
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация