RE: Writing text into images, and setting text size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Dave M G [mailto:martin@xxxxxxxxxxxxx]
> Sent: Monday, December 17, 2007 6:47 AM
> To: Casey
> Cc: PHP List
> Subject: Re:  Writing text into images, and setting text size
> 
> Casey,
> 
> Thank you for replying.
> 
> > Try imagettftext().
> 
> I did, as explained:
> 
> >> $font = '/usr/share/fonts/truetype/freefonts/FreeSans.ttf';
> >> $imagettftext($image, 20, 0, $x, $y-10, $textColour, $font, $text);
> 
> So my questions remain:
> 
> >> 1. 'FreeSans.ttf' is in my /usr/share/fonts/truetype/freefonts
> >> directory. But specifying it doesn't seem to work. How do I get the
> >> system to find the font?

I wouldn't. First, I don't know of any standard fonts for linux, though there might be (As you have Arial or Times New Roman for windows). Second, It might be a safe_mode / open_base_dir issue, or a problem in GD or the freetype libraries if the path is right and the font exist.
I would try something like dirname(__FILE__).'/fonts/Arial.ttf'... of course that would mean you need to create a "fonts" directory and copy Arial.ttf from your system to that location (violating the copywrite? ;) )... anyway, you can check that with any other font.

> >>
> >> 2. I need the scripts I'm writing to be portable, so can I be sure
> of
> >> what fonts will be available, and will I be able to locate them?
> >>

Deploy the fonts along with your scripts... that's the only way I know.

> >> 3. I'm not really concerned about what font it is, just that it's
> large
> >> and readable. If there are other options than what I've explored
> here,
> >> then I would be open to those too.

You can get some free fonts, and deploy them along with every project. I do so for a custom CAPTCHA script I've made.

> 
> Thank you for any advice.
> 
> --
> Dave M G
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695
Email: info@xxxxxxxxxxxxx  | MSN Chat: best@xxxxxxxxxxxxx  |  SKYPE: bestplace |  Web: http://www.bestplace.biz | Web: http://www.seo-diy.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux