Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Difficulty with using LWP to display JPEG

by trwww (Priest)
on Apr 12, 2014 at 16:57 UTC ( #1082099=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Difficulty with using LWP to display JPEG
in thread Difficulty with using LWP to display JPEG

What I am ultimately trying to do is make several HTTP requests to read in and print multiple images to the browser so that they appear on screen.

How are you calling your script? via an <img> tag in html? If thats the case, before you print the content you need to print the content type. I see this in your code:

$req->header('content-type' => 'image/jpeg');

You're setting a header in your lwp request, which is unnecessary. You should replace that line with:

print "Content-type: image/jpeg\n\n";

So you can tell the client that requested your script's output the content type of the output it will receive. Although without more information it seems like it would make sense to just have your image pull right from the remote server:

<img src="http://upload.wikimedia.org/wikipedia/en/7/70/Blogscope-logo-simple.jpg" />


Comment on Re^3: Difficulty with using LWP to display JPEG
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2014-08-23 05:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (172 votes), past polls