I got this working. I found what I was looking for at cpan's site.

http://search.cpan.org/dist/Image-Size/

works:

#!/usr/bin/perl -w
use strict;
# to read the files via http that each url points to.
my $img = "";
my $the_url = 'http://homepage.mac.com/galaher/images/maul.jpg';

# Since printing an image just shows a huge string, test with the following as well
# which shows an html page:
#my $the_url = 'http://homepage.mac.com/galaher/index.html';


use LWP::UserAgent;  # This will cover all of them!
use URI::URL;
use HTTP::Request;

my $hdrs = new HTTP::Headers(Accept => 'text/plain', UserAgent => 'MegaBrowser/1.0');

my $url = new URI::URL($the_url);
my $req = new HTTP::Request('GET', $url, $hdrs);
my $ua = new LWP::UserAgent;
my $resp = $ua->request($req);

if ($resp->is_success) {

        # If connection is successful the contents of the file
        # read will now go into the variable $img
        $img =  $resp->content;
        
}
else {

        # If connection is not successful then make note of this                
        print $resp->message;
        #$img = "socket_failure";
}


use Image::Size; # Assume that &read_data gets data somewhere (WWW, etc.) my ($height, $width, $id) = imgsize(\$img); print $height . " " . $width . " " . $id;



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to