CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
capture image?

 



tomhuan
stranger

Oct 25, 2001, 3:59 AM

Post #1 of 4 (463 views)
capture image? Can't Post

hi,

i want to know how to capture an image from internet using perl, i have some
codes below, but it seem not work:-


#!/usr/bin/perl -w
use LWP::Simple;

print "Content-Type: image/gif\n\n";
$content = get("http://xxx.com/xxx.jpg");
print $content;
exit;




mhx
Enthusiast / Moderator

Oct 25, 2001, 5:02 AM

Post #2 of 4 (462 views)
Re: capture image? [In reply to] Can't Post

So, what do you exactly mean by capture? If you mean putting the file on your disk then it's even simpler:

Code
#!/bin/perl -w 
use LWP::Simple;
print get shift;

Save this as getpic.pl and use the script like:

Code
getpic.pl http://path.to/pic.jpg >local.jpg

If you use Windows, you'll have to set standard output to binary mode:

Code
#!/bin/perl -w 
use LWP::Simple;
binmode STDOUT;
print get shift;

Hope this helps.

-- Marcus


Code
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= 
($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"



tomhuan
stranger

Oct 25, 2001, 5:44 AM

Post #3 of 4 (461 views)
Re: capture image? [In reply to] Can't Post

i mean get the image and print it on browser...



tomhuan
stranger

Oct 25, 2001, 5:50 AM

Post #4 of 4 (461 views)
Re: capture image? [In reply to] Can't Post

thanks very much, problem solve...


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives