Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with http pictures

Status
Not open for further replies.

zackiv31

Programmer
Joined
May 25, 2006
Messages
148
Location
US
I want to download jpg images from the internet here is the format:


I included the .asp part just in case it matters.... How can I work with http sites to download all of the jpgs? I will effectively be trying a bunch of files with similar timestamps to get them all.


So all I need is how to take a and save it through perl..

Thanks in advance
 
try this:

Code:
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $response =  $ua->get('[URL unfurl="true"]http://www.perl.org/simages/lcamel.gif');[/URL]
die "Unable to retrieve image." unless ($response->is_success);
print "Content-type: image/jpeg\n\n";
print $response->content;

Let us know your results!

X
 
Well it does something... doesn't throw an error... but after running it my command prompt goes crazy.. its like its trying to print it out or something, i want to save it to a file...

this is some of the crap i get...
?????:
??[????????@????????? ????]$
[????????@????????? ????]$
 
Got it...

Instead of printing the content... i just printed it to a file:

open(file,">out.jpg");
print file $response->content;
close file;


THANKS!
 
hehehe, printing a jpg file to the console is not very effective. ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top