By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,761 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,761 IT Pros & Developers. It's quick & easy.

how to get an image through perl ?

P: 55
Hi all,

i am looking for your help regarding this topic...

I am trying to download a image from the web through perl program.

I have used Image::Grab module for that task,through the module i am able to download the image....

But my problem is i want to get that image to be stored in the particular file path,(eg)" /home/image" ..I dont know how to do this...can some one heil me to overcome this problem..

source:

use Image::Grab qw(grab);

$image = grab(URL=>'http://www.cricbuzz.com/gayle.jpg');

print "$image";

if i am using the above code i am able to download the images from the site..

but this part is not clear to me..

<--!
open(IMAGE, ">image.jpg") || die"image.jpg: $!";
binmode IMAGE; # for MSDOS derivations.
print IMAGE $pic->image;
close IMAGE;
--!>
kindly guide me to know this ....

regards...
lastknight..
Jul 11 '07 #1
Share this Question
Share on Google+
1 Reply


miller
Expert 100+
P: 1,089
There should be nothing wrong with the code that you supplied in the comments. However, read this:

cpan lwptut

You should change image.jpg to an explicit path if you want to mirror gayle.jpg to a specific location.

Expand|Select|Wrap|Line Numbers
  1. use LWP::Simple;
  2.  
  3. mirror('http://www.cricbuzz.com/gayle.jpg', 'image.jpg');
  4.  
- Miller
Jul 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.