You are here: Re: Finding A Word's Length In Pixels « PHP Programming Language « IT news, forums, messages
Re: Finding A Word's Length In Pixels

Posted by william.oram on 08/23/07 15:01

On Aug 23, 8:58 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spamyourself.com> wrote:
> william.o...@gmail.com wrote:
> > Here's a toughie for me.
>
> > Using the GD library, I want to print a word or string as an image,
> > but with some constant amount of padding around it. The text is not
> > known beforehand. In other words, something like
>
> > ________
> > | |
> > | flan |
> > |________|
>
> > I'm very new to GD, but offhand the only solution that comes to mind
> > is to create a very long general-purpose image, print the text at (x1,
> > 0), measure the word there, destroy the image, then create a second
> > image with dimensions calculated from before. That seems rather
> > sloppy. Is there a better alternative?
>
> Hi,
>
> If you use freetype2 fonts, have a look at:
> imageftbbox()
> imagefontheight()
> imagefontwidth()
>
> That should do the trick.
>
> Regards,
> Erwin Moller

Perfect. Thanks!

 

Navigation:

[Reply to this 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

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