For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > January 2008 > Checking for text overflow (in PHP?)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Checking for text overflow (in PHP?)
Anze

2008-01-05, 7:00 pm

Hi!

I hope someone can help me out with this... I know the majority will
think "it can't be done", but let's suppose it _must_ be done - how could
it be done?

I am working on a form to compose text banners. The space for text is
(obviously) limited, the font is preset (assuming visitor doesn't change
the font size / face). What I would like is for PHP to have a way of
determining if the text fits into the space... The text is entered throught
XML (so no client checking is possible, everything must be done
server-side).

I could limit the number of characters, but some banners are not very wide
and the wrapping can make a huge difference in space consumed.

I know the solutions are probably too complicated / impossible to work on,
but still... I would appreciate any ideas how it _could_ be done if it
_must_ be done.

Is there some way PHP can access some Firefox engine to draw the banner and
figure out with JS if the banner text is too long? I would rather see if
the server was Linux, but it is not necessary... (I remember reading about
some PHP testing library using calls to IE?)

I also know that due to the very nature of HTML the same banner won't look
alike in IE, FF, Safari, Opera, Galeon, Konqueror, Lynx,... But let's
suppose that I want at least one referential browser where it looks OK (IE
or FF). And I know this is a total overkill, but - well, I'm curious how it
could be done. :)

I would appreciate any ideas,

Anze
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com