Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: LWP to download images, how to let LWP decide, wether it is an image or not?

by Beatnik (Parson)
on Oct 20, 2001 at 03:37 UTC ( #120175=note: print w/replies, xml ) Need Help??


in reply to LWP to download images, how to let LWP decide, wether it is an image or not?

What about something like...
if ($link =~ /(jpe?g|gif|png)$/i) { ...

Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.
  • Comment on Re: LWP to download images, how to let LWP decide, wether it is an image or not?
  • Download Code

Replies are listed 'Best First'.
Re: Re: LWP to download images, how to let LWP decide, wether it is an image or not?
by IndyZ (Friar) on Oct 20, 2001 at 07:39 UTC
    That's a good effort, but it will not work in all cases. Many sites (photoisland, yahoo photos) use a CGI to pull images out of a database. Although these files do not have the correct extension, they still return a valid image MIME type. Plus, I could fool your pattern like this: http://www.perlmonks.org/?jpg. That probably wouldn't do anything bad, other than a broken image, but still.

    --
    IndyZ

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://120175]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-09-26 08:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (117 votes). Check out past polls.

    Notices?