What function do you use in Perl to display an image file in a browser? If I want to display both text and an image, should I use two separate headers or create another program?
Apparently there is some confusion as to what I'm trying to do. Here's more clarification:
I want to output 2 images from my perl script to the browser, one will be generated within the script and the other is a separate image file stored on the server. I want to output both images as well as some text.
When I tried to open the file with this:
$q->header("image/png\n\n")
open(FILE, "name_of_image";
while (<FILE>);
print "$_\n";
I get a bunch of symbols and gibberish. I thought that maybe there is another function to display image files vs. text files.
Also, since I want to output both text & images, I wanted to know if I can use 2 different header types in my script or should I create a separate script for text & another for images.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.