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

Re^3: Difficulty with using LWP to display JPEG

by trwww (Priest)
on Apr 12, 2014 at 16:57 UTC ( [id://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="" />