I think I may be misunderstanding the units between image size and text string length (one is probably pixels and the other characters) so am comparing apples to oranges in trying to center text onto an image:
The math looks right to me but the text is off to the right, nearly off the image. Any clarification?
Although not as big an issue, how can I center vertically? Is there a function for measuring the height of text? I am using one of the default fonts now ("3") but may use TrueType later so then, it will be more important to make it dynamic, if possible.
Also, if the image, is shorter than the text, can it be stretched somehow with specific padding on the ends? It is a jpg, by the way, but is stored in the MySQL database rather than being a physical image.
Don
contact@pc-homepage.com
Experienced in HTML, Perl, PHP, VBScript, PWS, IIS and Apache and MS-Access, MS-SQL, MySQL databases
Code:
imagestring($im, 3, (imagesx($im)-(strlen($string))/2), 9, $string, $FontColor);
The math looks right to me but the text is off to the right, nearly off the image. Any clarification?
Although not as big an issue, how can I center vertically? Is there a function for measuring the height of text? I am using one of the default fonts now ("3") but may use TrueType later so then, it will be more important to make it dynamic, if possible.
Also, if the image, is shorter than the text, can it be stretched somehow with specific padding on the ends? It is a jpg, by the way, but is stored in the MySQL database rather than being a physical image.
Don
contact@pc-homepage.com
Experienced in HTML, Perl, PHP, VBScript, PWS, IIS and Apache and MS-Access, MS-SQL, MySQL databases