RE: [PHP] Writing text into images, and setting text size
| From: | Andrés Robinet | Date: | Tue, 18 Dec 2007 16:15:30 +0000 |
| Subject: | RE: [PHP] Writing text into images, and setting text size | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266034@lists.php.net to get a copy of this message | ||
Hi Dave,
Take a look
http://www.bestplace.biz/unittest/ttf/PrintImage.php
... and replace PrintImage.php with info.php in the URL to get the phpinfo.
See the CONFIGURE COMMAND line for the phpinfo (at the very beginning):
'--with-gd'
'--enable-gd-native-ttf'
'--with-ttf'
'--with-jpeg-dir=/usr/local/lib'
'--with-freetype-dir=/usr/local/lib'
'--with-png-dir=/usr/local/lib'
You might need to change /usr/local/lib according to your system configuration (this is a CentOS 4
box with DirectAdmin as the hosting control panel) and recompile PHP. However, before you run into
an unnecessary mess...
1 - Add this line to the very beginning of the script and remove the code that outputs the image
(all the "header" stuff and the "imagepng($im)" sentence):
error_reporting(E_ALL);
I guess you have already don that but just in case... If there's an error you should see it
with E_ALL
2 - If you find out that the problem is definitely PHP, you'd better off using the provided
upgrade methods of your hosting control panel, or a standard or custom script provided at the
hosting control panel's website. That will make your life easier (For DirectAdmin, there's
custombuild, for others... I don't know)... otherwise, you'll have to edit the configure
script, and run ./configure, make and make install as usual (and troubleshoot as usual).
Hope you get it working, :)
Rob
> -----Original Message-----
> From: Dave M G [mailto:martin@autotelic.com]
> Sent: Tuesday, December 18, 2007 7:06 AM
> To: Andrés Robinet
> Cc: 'PHP List'
> Subject: Re: [PHP] Writing text into images, and setting text size
>
> Rob,
>
> Thank you for responding.
>
> > Try the following:
> > ... you load PrintImage.php into your browser and you'll get a nice
> gray rectangle with the word "Works!" in the center of it.
> > If you don't get that... then you have a problem that is not related
> to path or to PHP per-se...
>
> Wow... thank you so much for providing that code to help me test my
> environment.
>
> I ran your script - with the corrections you provided - and did not get
> the text that says "Works!".
>
> I've checked with various fonts, and checked that they worked in
> OpenOffice and other apps, so I don't think fonts are the problem.
>
> As for GD support, phpinfo() it says:
>
> GD Support enabled
> GD Version 2.0 or higher
> FreeType Support enabled
> FreeType Linkage with freetype
> FreeType Version 2.1.9
> T1Lib Support enabled
> GIF Read Support enabled
> GIF Create Support enabled
> JPG Support enabled
> PNG Support enabled
> WBMP Support enabled
> GetText Support enabled
>
> Am I missing a necessary module?
>
> > Hope this helps
>
> It helps very much. Thank you.
>
> --
> Dave M G
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php