Posted on 2009-06-08 17:12:10-07 by demonjack
GD::Image Can't locate object newFromPng
FreeBSD 7.0 Perl 5.8.9 I installed... libpng-1.2.36 gd-2.0.35 GD-2.41 I made sure all compiled with PNG support. However, whenever I try and run the following line of code.
my $myImage = newFromPng GD::Image(\*PNG); or alternatively.... my $myImage = GD::Image->newFromPng($imgFile, 1)
I get the following error. Can't located object method "newFromPng" via package "GD::Image" at blah blah blah. I'm sure it's something I've missed but I can't find it. At this point I've looked at it so much I can't see the forest for the trees....... This is a piece of code that will always generate the error:
#!/usr/bin/perl # # use Cflow qw(:flowvars find); # for reading Cflowd data files use Socket; # for socket functions use POSIX; # for strftime use RRDs; # RRDTOOL stuff use Time::Local; # need the timelocal function use Storable; use Net::Patricia; use GD; use strict; use warnings; my $imgFile = "image-16790-0001.png"; my $newimage = new GD::Image(100,100); open (PNG, $imgFile) || die; my $myImage = newFromPng GD::Image(\*PNG); close PNG;
This is the output from the ldd command. Looks like it built with PNG support. /usr/local/lib/perl5/site_perl/5.8.9/mach/auto/GD/GD.so: libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1 (0x281a0000) libfreetype.so.9 => /usr/local/lib/libfreetype.so.9 (0x28300000) libpng12.so.0 => /usr/local/lib/libpng12.so.0 (0x281c9000) libm.so.5 => /lib/libm.so.5 (0x28372000) libgd.so.2 => /usr/local/lib/libgd.so.2 (0x28387000) libc.so.7 => /lib/libc.so.7 (0x28080000) libz.so.4 => /lib/libz.so.4 (0x281ec000) libexpat.so.6 => /usr/local/lib/libexpat.so.6 (0x283d9000) libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x283f9000) Any help would be appreciated. I'm going to go take a nap. thx Demon
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.