(none) imager-devel
/ help / lists / applications / search /
 

Resizing a jpg file

From: gak (
03619@xyz.molar.is)
Date: Tue 20 Nov 2001 - 13:47:39 UTC

  • Next message: gak: "Re: Resizing a jpg file"

    The capabilities of Imager are very exciting. We look
    forward to putting them to use. Tried the brief
    script shown at the top of the documentation, but I'm
    getting an error:

    "Can't call method 'write' on an undefined value.."

    It then references the scaled write command. Here is
    the code. What am I missing?

    #!/usr/bin/perl
    use CGI;
    use CGI::Carp qw/fatalsToBrowser/;

    use Imager qw(init);

    init();

      $img=Imager->new();
      $img->open(file=>'727_orig.jpg',type=>'jpeg')
        || print "failed: ",$img->{ERRSTR},"\n";
      $scaled=$img->scale(xpixels=>400,ypixels=>400);
      $scaled->write(file=>'727.jpg',type=>'jpeg')
        || print "failed: ",$scaled->{ERRSTR},"\n";
         
    print "Content-type: text/html\n\n";
    print "
    <html><head>
    <title>Done</title></head>
    <body>
    The file has been resized.
    </body></html>
    ";

    THANKS!

    __________________________________________________
    Do You Yahoo!?
    Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
    http://geocities.yahoo.com/ps/info1



  •