Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: Tom Peck on April 05, 2001, 05:04:01 AM

Title: GD Graphics Library with PHP
Post by: Tom Peck on April 05, 2001, 05:04:01 AM
Hello

PHP has been configured by default with the GD library like so: '--with-gd=shared'

How then do we use this library?  I've tried a few different methods, including the example from PHP.net, which is this:

header ("Content-type: image/png");
$im = @ImageCreate (50, 100)
    or die ("Cannot Initialize new GD image stream");
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5,  "A Simple Text String", $text_color);
ImagePng ($im);
?>

But they don't appear to work..  Has anyone successfully managed to use the GD library?

Cheers

Tom
Title: Re: GD Graphics Library with PHP
Post by: Dan Brown on April 06, 2001, 08:36:40 AM
First, look at a phpinfo(); page.  If it doesn't include a heading for gd, you don't have GD support.  I believe e-smith is using stock RedHat 7 PHP RPMs, so you'd need to locate a php-gd RPM from RedHat 7.  Alternatively, upgrade your PHP RPMs to 4.0.4pl1 from rpms.arvin.dk.
Title: Re: GD Graphics Library with PHP
Post by: Tom Peck on April 06, 2001, 09:03:57 AM
Thanks for the Info Dan - that site is damn fine!

Quick question:  Should I remove the existing PHP RPM before installing the new RPMs?  Is this going to cause problems with e-smith if I do this?

Cheers

Tom
Title: Re: GD Graphics Library with PHP
Post by: Dan Brown on April 09, 2001, 07:47:31 AM
You shouldn't need to remove the existing PHP RPM--my recollection is that I just downloaded the new ones and did rpm -Uvh on them.
Title: Re: GD Graphics Library with PHP
Post by: Franck PIERRE on April 22, 2001, 07:33:59 AM
Here is what i did, and it seems to work very well :

I tried to upgrade PHP with RH7.0-upgrade RPMS but i had dependances problems with arvin's ones.
So, I downloaded all RPMs from http://rpms.arvin.dk/php/install-ready/i586/ (my e-smith box processor is an AMD K5).

rpm -Uvh --nodeps php-4.0.4pl1-10.arvin.i586.rpm
rpm -Uvh mod_php-4.0.4pl1-10.arvin.i586.rpm
rpm -Uvh php-imap-4.0.4pl1-10.arvin.i586.rpm
rpm -Uvh php-mysql-4.0.4pl1-10.arvin.i586.rpm
rpm -Uvh php-ldap-4.0.4pl1-10.arvin.i586.rpm
rpm -Uvh php-gd-4.0.4pl1-10.arvin.i586.rpm
/etc/rc.d/init.d/httpd-e-smith restart
/etc/rc.d/init.d/httpd-admin restart
/etc/rc.d/init.d/httpd restart

Now, imagecreate() and other graphic functions work great and i haven't yet noticed any problem with IMP or e-smith-manager.

Regards.
--
Franck
grand-pa@grand-pa.dyndns.org
http://www.grand-pa.dyndns.org
Title: Re: GD Graphics Library with PHP
Post by: thomas on April 23, 2001, 02:17:27 AM
thanks for the really good url, but do you have an idea where I can find rpms for the i386-architecture? (I have an 486-DX-PC)

Thanks
Title: Re: GD Graphics Library with PHP
Post by: thomas on April 23, 2001, 02:46:57 AM
sorry, just found some modules, also by alvin, at rpmfind.net, for i386.

some other rpms (like expat-1.95...) needed but if they are installed it works like hell ;-).
Title: Re: GD Graphics Library with PHP
Post by: Franck PIERRE on April 23, 2001, 04:44:09 AM
Well, i have found too late the php-gd-4.0.3pl1-4.i386.rpm on
ftp.e-smith.org/e-smith/contrib/DanBrown/RPMS/i386

Of course, i haven't tested it. But i guess it should work fine

Regards.
--
Franck
grand-pa@grand-pa.dyndns.org
http://www.grand-pa.dyndns.org