in reply to Understanding GD.pm

Have you read the existing nodes about GD on Perl Monks? You might find some useful information there.

From a quick glance at your code, I notice you don't use strict or CGI. You might find several of the Tutorials here useful, such as use CGI or die; and CGI Help Guide.

Although you check for errors when opening file.jpg, you don't check for errors elsewhere, such as when you call GD::Image->newFromJpeg(). You have no way of knowing whether these methods succeed or fail.

Replies are listed 'Best First'.
Re: Re: Understanding GD.pm
by cal (Beadle) on Oct 31, 2002 at 15:54 UTC
    Thanks,

    GD is not the preferred library for image manipulaiton within PerlMonks forums or anywhere else. Image::Magik is. Unfortunatly, I am not able to use it.

    I am not sure that use CGI; is required when only using the GD library. I have not needed to use it in the past with GD. But I added it to the script. No change.I get a blank page.

    The error checking was a good point. I added it with no change.I get a blank page.

    Do you mean use diagnostics or warnings?

    As far as strict goes it did show premature script headers. But I cant find what is causing this..
    Thanks again Cal
      GD is not the preferred library for image manipulaiton within PerlMonks forums or anywhere else.

      There's more than one way to do it. Sometimes you might prefer GD to complete a task, other times you might prefer ImageMagick.

      I am not sure that use CGI; is required when only using the GD library.

      Your code contains the line print "Content-type: text/html\n\n"; which suggests you are writing a CGI script. This suggestion has nothing to do with GD: when writing a CGI script, use CGI.

      The error checking was a good point. I added it with no change.I get a blank page.

      As I mentioned earlier, read the Tutorials that seem relevant. Learn about other debugging techniques that might help you find the cause of this problem.

      If you haven't done so already, read the GD documentation carefully to ensure your code uses it correctly.