in reply to Understanding GD.pm

In addition to the above comments, it's worth noting that simpler is usually better. I know you copied the script from a CGI, but it would probably benefit you to remove the CGI code and run it straight from the terminal, if you have that option. With strict and warnings on, you'll see a lot of useful output that way. Apart from that, it may be your web server's fault that you're not seeing the print statement. (It could also be your browser; did you look at the source of the blank page?) Cutting those possible sources of error out of the loop might save you a few headaches.

Either way, even if the print statement hasn't shown up, the jpeg may have been saved to disk. From the code you posted, it will never be displayed on the web page, even if the script runs successfully. It sounds like you're looking for the output on the web page itself. Have you checked the filesystem to see if it's there?
--

Love justice; desire mercy.

Replies are listed 'Best First'.
Re: Re: Understanding GD.pm
by cal (Beadle) on Oct 31, 2002 at 15:26 UTC
    Thanks so much,
    I wish I was able to run a command line.
    I agree strict and warnings should always be used.
    The jpg did not save to disk. That was the first thing I checked for.
    I really did not see any code in my post that should print the new or old jpg to screen.

    Cal
      Ouch. That's a tough case to be in.

      If the code you posted was the whole thing, may I suggest a few additions? If you add these lines to the end:
      close FILE; print "<img src = 'test.jpg'></body></html>\n\n";
      and this to the beginning, after the header:
      print "<html><head><title>Test page</title></html><body>\n";
      That will make your output an actual HTML page, and make your Perl just a tough more correct. I don't honestly think that's your problem, but it wouldn't hurt to make sure that it isn't.
      --

      Love justice; desire mercy.
        Thanks , You know I did not even notice there was no  close FILE;at the end of the script. Thanks for pointing that out.
        Well is what I get is a blank page but it is the test page. HTML produced:<html><head><title>Test page</title></head><body> I am trying some more print statements. I will update soon. Thanks again
        Thanks for your help,

        I ran some print statements and the buck stops here:

        my $srcimage = GD::Image->newFromJpeg('churchmiddle.jpg');

        I guess I am wondering now if the script is comunicating with the GD Module.
        Thanks for your help,

        I ran some print statements and the buck stops here:

        my $srcimage = GD::Image->newFromJpeg('churchmiddle.jpg');

        I guess I am wondering now if the script is comunicating with the GD Module.