Problem with Image::Info

Discussion in 'Perl Misc' started by Gary, Apr 28, 2007.

  1. Gary

    Gary Guest

    I am trying to write a perl cgi script using Image::Info. The problem
    is
    I am not getting any info from Image::Info. The hash comes back
    empty.
    If I reduce my script down to what is shown below the page that gets
    displayed
    only has the photo. If the hash wasn't empty "Good" should be
    displayed above
    the photo. I have never used Image::Info before. I am using the
    module
    description in CPAN, there are no error messages in the browser
    error log and the page is being displayed. Are there any suggestions?

    Gary

    #!/usr/bin/perl -w
    use strict;
    use CGI qw:)standard);
    use Image::Info qw(image_info dim);

    my $Photo = param('photo');
    my $info = image_info("$Photo");

    print header;
    print start_html(-title=>'My Photos', -bgcolor=>'#FFDEAD');

    if (%info){
    print "Good <br> \n";
    }

    print "<img SRC=\"$Photo\"/>",
    print end_html;
     
    Gary, Apr 28, 2007
    #1
    1. Advertising

  2. Gary

    Brian Wakem Guest

    Gary wrote:

    > #!/usr/bin/perl -w
    > use strict;
    > use CGI qw:)standard);
    > use Image::Info qw(image_info dim);
    >
    > my $Photo = param('photo');
    > my $info = image_info("$Photo");
    >
    > print header;
    > print start_html(-title=>'My Photos',  -bgcolor=>'#FFDEAD');
    >
    > if (%info){
    > print "Good <br> \n";
    > }
    >
    > print "<img SRC=\"$Photo\"/>",
    > print end_html;



    $ perl tmp119.pl
    Global symbol "%info" requires explicit package name at tmp119.pl line 12.
    Execution of tmp119.pl aborted due to compilation errors.


    I assume $info is a reference to a hash, in which case you need to read
    perldoc perlref


    --
    Brian Wakem
    Email: http://homepage.ntlworld.com/b.wakem/myemail.png
     
    Brian Wakem, Apr 28, 2007
    #2
    1. Advertising

  3. Gary

    Joe Smith Guest

    Gary wrote:

    > #!/usr/bin/perl -w


    #!/usr/bin/perl
    use warnings;

    > use strict;
    > use CGI qw:)standard);
    > use Image::Info qw(image_info dim);
    >
    > my $Photo = param('photo');
    > my $info = image_info("$Photo");
    >
    > print header;
    > print start_html(-title=>'My Photos', -bgcolor=>'#FFDEAD');
    >
    > if (%info){
    > print "Good <br> \n";
    > }
    > print "<img SRC=\"$Photo\"/>",
    > print end_html;


    print h1("No photo name specified") unless $Photo;
    print h1("File '$Photo' does not exist in this directory
    on the server") unless -f $Photo;
    if ($info) {
    print img({img=>$Photo,alt=>$Photo}), start_ul();
    print li(b($_)," = $info->{$_}") for sort keys %$info;
    print end_ul();
    } else {
    print h1("Unable to get image_info from '$Photo'");
    }


    That last part needs
    use CGI qw:)standard *ul);


    -Joe
     
    Joe Smith, May 2, 2007
    #3
  4. Gary

    Dr.Ruud Guest

    Joe Smith schreef:

    > print h1("No photo name specified") unless $Photo;
    > print h1("File '$Photo' does not exist in this directory
    > on the server") unless -f $Photo;


    s/print/die/g

    --
    Affijn, Ruud

    "Gewoon is een tijger."
     
    Dr.Ruud, May 2, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vasanth
    Replies:
    0
    Views:
    599
    Vasanth
    Jun 28, 2004
  2. Andrea Williams

    Clear the Render info & change to different info

    Andrea Williams, Oct 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,456
    Ken Dopierala Jr.
    Oct 27, 2004
  3. Kiran
    Replies:
    0
    Views:
    1,255
    Kiran
    Feb 6, 2005
  4. ilya

    get CPU info, RAM info

    ilya, Apr 8, 2010, in forum: Java
    Replies:
    43
    Views:
    6,254
    Mike Schilling
    Apr 19, 2010
  5. Kenshin
    Replies:
    1
    Views:
    243
    Jeff Cochran
    Jun 25, 2004
Loading...

Share This Page