imagecreatefrompng() proplem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
icarpenter
Forum Commoner
Posts: 84
Joined: Mon Mar 07, 2005 8:12 am
Location: Kent, England

imagecreatefrompng() proplem

Post by icarpenter »

I am using PHP 4.3.10 and I am trying to call the system function

Code: Select all

imagecreatefrompng('mypng.png')
I get the following error:-

Fatal error: Call to undefined function: imagecreatefrompng()

Has anyone come accross this error before?

Thanks Ian
tuanfishy
Forum Newbie
Posts: 4
Joined: Tue Jun 28, 2005 1:47 pm
Location: Canada

Post by tuanfishy »

Try looking at http://ca.php.net/imagecreatefrompng it might help.

This is was an example on that site:
$imgPng = imageCreateFromPng($strImagePath);
Revan
Forum Commoner
Posts: 83
Joined: Fri Jul 02, 2004 12:37 am
Location: New Mexico, USA
Contact:

Post by Revan »

GD isn't loaded?
User avatar
icarpenter
Forum Commoner
Posts: 84
Joined: Mon Mar 07, 2005 8:12 am
Location: Kent, England

Post by icarpenter »

I didn't think it had to be if you are running PHP 4.3.10!

Do I have to enable something in PHP.ini?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

GD needs to be compiled in. Failing that, you can dl() the extension during runtime. To see if it's compiled in, just call phpinfo() and there should be a GD section in the resulting page, if it is compiled in.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
icarpenter
Forum Commoner
Posts: 84
Joined: Mon Mar 07, 2005 8:12 am
Location: Kent, England

imagecreatefrompng()

Post by icarpenter »

Thats got it Thanks Pickle!!!

For those who are interested....

The php_gd2.dll was not installed I had to copy this to C:\windows\sytem32 and remove the ';' in th PHP.ini file that preceeds the php_gd2.dll...


It might be worth noting that the extensions folder with loads of .Dll files in PHP version 4.3.10 does not download automatically using the installer...

Rgds Ian.
Post Reply