in reply to Qestion about GD::SecurityImage

It seems I miss some mysql stuff in order to run this demo script. Any idea?

Um, resolve the error? You know, read the instructions, do what they say .... http://cpansearch.perl.org/src/BURAK/GD-SecurityImage-1.70/eg/demo.pl

Replies are listed 'Best First'.
Re^2: Qestion about GD::SecurityImage
by sman (Beadle) on Jan 29, 2010 at 10:28 UTC
    Thanks for your reply. I follow the instruction and run the demo.pl as a CGI program successfully except the image does not show up (only see its alt string). Then I try this GD test code :
    use GD; # create a new image $im = new GD::Image( 100, 100 ); # allocate some colors $white = $im->colorAllocate( 255, 255, 255 ); $black = $im->colorAllocate( 0, 0, 0 ); $red = $im->colorAllocate( 255, 0, 0 ); $blue = $im->colorAllocate( 0, 0, 255 ); # make the background transparent and interlaced $im->transparent($white); $im->interlaced('true'); # Put a black frame around the picture $im->rectangle( 0, 0, 99, 99, $black ); # Draw a blue oval $im->arc( 50, 50, 95, 75, 0, 360, $blue ); # And fill it with red $im->fill( 50, 50, $red ); # make sure we are writing to a binary stream binmode STDOUT; # Convert the image to PNG and print it on standard output print $im->jpeg;
    And then I got a error message like this:
    [cmo@fedora ~]$ perl gdtest.pl > test.jpeg Can't locate object method "jpeg" via package "GD::Image" at gdtest.pl + line 29.
    line 29 is "print $im->jpeg;". GD::Image is installed successfully but Why this error happen?

    Thanks again.

      Did you install the JPEG library prior to installing as described in the README?

        Hi, I already installed jpegsrc.v6b.tar.gz like the following but still see the image's alt 'Security Image' only. Is there anywhere else I can check?
        [abc@fedora jpeg-6b]$ sudo make install /usr/bin/install -c cjpeg /usr/local/bin/cjpeg /usr/bin/install -c djpeg /usr/local/bin/djpeg /usr/bin/install -c jpegtran /usr/local/bin/jpegtran /usr/bin/install -c rdjpgcom /usr/local/bin/rdjpgcom /usr/bin/install -c wrjpgcom /usr/local/bin/wrjpgcom /usr/bin/install -c -m 644 ./cjpeg.1 /usr/local/man/man1/cjpeg.1 /usr/bin/install -c -m 644 ./djpeg.1 /usr/local/man/man1/djpeg.1 /usr/bin/install -c -m 644 ./jpegtran.1 /usr/local/man/man1/jpegtran.1 /usr/bin/install -c -m 644 ./rdjpgcom.1 /usr/local/man/man1/rdjpgcom.1 /usr/bin/install -c -m 644 ./wrjpgcom.1 /usr/local/man/man1/wrjpgcom.1
        I also checked mysql table like this:
        mysql> select * from sessions; +----------------------------------+---------------------------------- +-------------------------------------------------+ | id | a_session + | +----------------------------------+---------------------------------- +-------------------------------------------------+ | e6a5ed9dd1afc80ad115097e97ea7e5c |   e6a5ed9dd1afc80ad115097e97ea7e5c _session_id security_code | | abe1ec864cf636ea147b8982331fc211 |   abe1ec864cf636ea147b8982331fc211 _session_id security_code | | 4a926009da58be40afdad7baef41d9e4 |   4a926009da58be40afdad7baef41d9e4 _session_id security_code | | 7a65f897282e294c9153892395dfe84c |   7a65f897282e294c9153892395dfe84c _session_id security_code | +----------------------------------+---------------------------------- +-------------------------------------------------+ 4 rows in set (0.00 sec)
        BTW, I noticed there are totally three items in the OPTIONAL section for Linux INSTALLATION from the README file. Are they all necessary to run demo.pl ? Thanks.
        (OPTIONAL) The FreeType font rendering library for TrueType fonts. The JPEG library, version 6b or later The XPM library,
        And perl gdtest.pl > test.jpeg still does not work.
      Also check the version of GD, only newer versions support jpeg.
        Hi, The GD version is 2.44.