Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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="" />

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2016-10-24 09:53 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (304 votes). Check out past polls.