Professional Web Applications Themes

Can't locate object method "newFromJpeg" via package "GD::Image" - PERL Modules

Hi. I'm trying to execute this Perl simple script: -------- #!/usr/bin/perl use GD; my $srcimage = GD::Image->newFromJpeg("image_news.jpg"); my ($srcW,$srcH) = $srcimage->getBounds(); --------- But I get this error message: ------- Can't locate object method "newFromJpeg" via package "GD::Image" at ../test.pl line 3. ------- I've got GD and libgd compiled with JPEG support turned on. 1) JPEG libs + Downloaded from [url]http://www.ijg.org/files/jpegsrc.v6b.tar.gz[/url] + mkdir /usr/local/jpeg-6b + mkdir /usr/local/jpeg-6b/bin + mkdir /usr/local/jpeg-6b/man + mkdir /usr/local/jpeg-6b/man/man1 + mkdir /usr/local/jpeg-6b/incude + mkdir /usr/local/jpeg-6b/lib + ./configure --prefix=/usr/local/jpeg-6b --enable-shared + make + make test + make install 2) libgd + Downloaded from [url]http://www.boutell.com/gd/http/[/url] + mkdir /usr/local/gd + ...

  1. #1

    Default Can't locate object method "newFromJpeg" via package "GD::Image"

    Hi.

    I'm trying to execute this Perl simple script:
    --------
    #!/usr/bin/perl
    use GD;
    my $srcimage = GD::Image->newFromJpeg("image_news.jpg");
    my ($srcW,$srcH) = $srcimage->getBounds();
    ---------

    But I get this error message:
    -------
    Can't locate object method "newFromJpeg" via package "GD::Image" at
    ../test.pl line 3.
    -------

    I've got GD and libgd compiled with JPEG support turned on.


    1) JPEG libs
    + Downloaded from [url]http://www.ijg.org/files/jpegsrc.v6b.tar.gz[/url]
    + mkdir /usr/local/jpeg-6b
    + mkdir /usr/local/jpeg-6b/bin
    + mkdir /usr/local/jpeg-6b/man
    + mkdir /usr/local/jpeg-6b/man/man1
    + mkdir /usr/local/jpeg-6b/incude
    + mkdir /usr/local/jpeg-6b/lib
    + ./configure --prefix=/usr/local/jpeg-6b --enable-shared
    + make
    + make test
    + make install

    2) libgd
    + Downloaded from [url]http://www.boutell.com/gd/http/[/url]
    + mkdir /usr/local/gd
    + ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg-6b
    + make
    + make install

    3) GD-Perl
    + Downloaded from [url]http://search.cpan.org/~lds/GD-2.30/[/url]
    + export
    LD_LIBRARY_PATH=/usr/local/lib:/usr/local/gd/lib:/usr/local/zlib/lib:/usr/local/jpeg-6b/lib:$LD_LIBRARY_PATH
    + perl Makefile.PL GD_JPEG -lib_gd_path /usr/local/gd -lib_jpeg_path
    /usr/local/jpeg-6b -lib_zlib_path /usr/local/zlib
    ---------
    Included Features: GD_JPEG GD_FREETYPE GD_PNG GD_GIF
    GD_UNCLOSEDPOLY GD_ANIMGIF GD_FTCIRCLE VERSION_33
    GD library used from: /usr/local/gd
    JPEG library used from: /usr/local/jpeg-6b
    Zlib library used from: /usr/local/zlib
    ....
    Checking if your kit is complete...
    Looks good
    Writing Makefile for GD
    -----------
    + make
    -------------------
    ...
    gcc -c -I/usr/local/zlib/include -I/usr/local/jpeg-6b/include
    -I/usr/local/include -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
    -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include
    -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g
    -pipe -m32 -march=i386 -mtune=pentium4 -DVERSION=\"2.30\"
    -DXS_VERSION=\"2.30\" -fPIC
    "-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE" -DHAVE_JPEG
    -DHAVE_FT -DHAVE_GIF -DHAVE_PNG -DHAVE_ANIMGIF -DVERSION_33
    -DHAVE_UNCLOSEDPOLY -DHAVE_FTCIRCLE GD.c
    ....
    gcc -shared -L/usr/local/lib GD.o -o blib/arch/auto/GD/GD.so
    -L/usr/local/zlib/lib -L/usr/local/jpeg-6b/lib -L/usr/local/lib
    -L/usr/local/lib -L/usr/local/lib -ljpeg -lfreetype -lpng12 -lz -lm
    -lgd
    ....
    Manifying blib/man1/bdf2gdfont.pl.1
    Manifying blib/man3/GD::Polyline.3pm
    Manifying blib/man3/GD::Image.3pm
    Manifying blib/man3/GD::Simple.3pm
    Manifying blib/man3/GD.3pm
    Manifying blib/man3/GD::Polygon.3pm
    --------------------
    + make test
    ---------------------
    All tests successful, 3 subtests skipped.
    Files=2, Tests=13, 1 wallclock secs ( 0.22 cusr + 0.03 csys = 0.25
    CPU)
    --------------------
    + make install
    ---------------------
    Installing
    /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/GD/GD.so
    Files found in blib/arch: installing files in blib/lib into
    architecture dependent library tree
    Writing
    /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/GD/.packlistAppending
    installation info to
    /usr/lib/perl5/5.8.5/i386-linux-thread-multi/perllocal.pod
    ----------------------

    Within '/etc/ld.so.conf':
    --------
    /usr/local/gd/lib
    /usr/local/zlib/lib
    /usr/local/jpeg-6b/lib
    --------

    What am I doing wrong? Thank you very much.

    francescomoi@usa.com Guest

  2. #2

    Default Re: Can't locate object method "newFromJpeg" via package "GD::Image"


    <francescomoiusa.com> wrote in message
    news:1134990197.769908.282800f14g2000cwb.googlegr oups.com...
    > Hi.
    >
    > I'm trying to execute this Perl simple script:
    > --------
    > #!/usr/bin/perl
    > use GD;
    > my $srcimage = GD::Image->newFromJpeg("image_news.jpg");
    > my ($srcW,$srcH) = $srcimage->getBounds();
    > ---------
    >
    > But I get this error message:
    > -------
    > Can't locate object method "newFromJpeg" via package "GD::Image" at
    > ./test.pl line 3.
    > -------
    >
    That's puzzling. You're script works fine for me with version 2.23. Does
    version 2.30 still define a 'newFromJpeg' sub ? (I would think it does. The
    doentation claims that it does.)

    Are there any other versions of GD installed ?

    It might pay to check that you are, in fact, running version 2.30:

    #!/usr/bin/perl
    use GD;
    print $GD::VERSION, "\n";
    __END__

    Cheers,
    Rob


    Sisyphus Guest

  3. #3

    Default Re: Can't locate object method "newFromJpeg" via package "GD::Image"


    Sisyphus wrote:
    >
    > That's puzzling. You're script works fine for me with version 2.23. Does
    > version 2.30 still define a 'newFromJpeg' sub ? (I would think it does. The
    > doentation claims that it does.)
    >
    > Are there any other versions of GD installed ?
    >
    > It might pay to check that you are, in fact, running version 2.30:
    >
    > #!/usr/bin/perl
    > use GD;
    > print $GD::VERSION, "\n";
    > __END__
    Yes, I'm using 2.30.
    How can I check if I've got other versions of GD installed? It may be,
    cause I've
    been doing several tests with several versions.

    >
    > Cheers,
    > Rob
    Francesco Moi Guest

  4. #4

    Default Re: Can't locate object method "newFromJpeg" via package "GD::Image"


    "Francesco Moi" <franscescomoiusa.com>
    > >
    > > #!/usr/bin/perl
    > > use GD;
    > > print $GD::VERSION, "\n";
    > > __END__
    >
    > Yes, I'm using 2.30.
    > How can I check if I've got other versions of GD installed? It may be,
    > cause I've
    > been doing several tests with several versions.
    If the above script is reporting '2.30' then that's the version of GD that's
    being found.

    I just installed version 2.30 on my Win32 box and the script you posted
    still works fine. However, I found that if I build GD-2.30 *without* jpeg
    support, then I get an error very similar to yours when I run the script you
    originally posted. I get:

    Can't locate object method "_newFromJpeg" via package "GD::Image" at
    D:/perl58_M/site/5.8.7/lib/GD/Image.pm line 185.

    Essentially there are 2 differences:
    1) for me, the object method "_newFromJpeg" is not found, whereas your error
    reported that the object method "newFromJpeg" is not found;
    2) my error is reported in Image.pm, whereas yours was reported in the
    script.

    I'm starting to think that, although you *think* your GD-2.30 was built with
    jpeg support, perhaps it wasn't. However, when I look at the output you
    posted originally, it looks to me that your GD-2.30 *was* built with jpeg
    support.

    Did you specify 'y' at all of the prompts when 'perl Makefile.PL' was run ?
    It might be informative to find out which subtests were skipped. Try
    running:

    perl -Mblib t\GD.t

    and:

    perl -Mblib t\Polyline.t

    However .... basically, I'm stumped by this - and am hoping that someone
    that actually *knows* what has gone wrong comes forward :-)

    Perhaps Google will turn up an answer for you .... or you might have to
    contact the author if all else fails.

    Cheers,
    Rob


    Sisyphus Guest

Similar Threads

  1. Can't locate object method "blocking" via package "IO::Handle"
    By kemton@kemton.com in forum PERL Modules
    Replies: 1
    Last Post: June 20th, 02:54 PM
  2. GD::Image: Can't locate object method "newFromJpeg"
    By dirson@gmail.com in forum PERL Modules
    Replies: 1
    Last Post: April 4th, 07:46 PM
  3. Replies: 2
    Last Post: November 2nd, 08:39 PM
  4. Can't locate object method "get" via package "LWP::UserAgent"
    By Perldiscuss - Perl Newsgroups And Mailing Lists in forum PERL Beginners
    Replies: 1
    Last Post: November 25th, 07:29 PM
  5. Can't not locate object method "isadmin" via package "Noc1"
    By Perldiscuss - Perl Newsgroups And Mailing Lists in forum PERL Beginners
    Replies: 1
    Last Post: November 13th, 03:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139