Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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="http://upload.wikimedia.org/wikipedia/en/7/70/Blogscope-logo-simple.jpg" />

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (1)
As of 2024-04-19 00:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found