Hi,
I'm trying to send existing images (not generated) to a browser. The difference is, is the html code contains the <img ..> call, which calls a cgi, which then sends the image to the browser. The idea behind it, is to keep people from externally linking to the images. Thus far I have gotten nothing to work. The closest I have gotten was with an error from the server stating that the image file had a malformed headder (hmm its an image!).
So to help clairify:
In the html:
<img border="0" src="/cgi-bin/my.cgi?image=images/some.jpg" width="368
+"
height="275">
In the cgi/perl, I tried:
print "Location: /cgi-bin/$in{image}\n\n";
# (I get malformed headder, but only on image files, zip or exe
# files are sent (if I don't call using <img ..>))
And:
print "/cgi-bin/$in{image}"; # (I get nothing, no image, no error)
I have also tried using Content-type: headders, but they as well, do not help.
How can I get the cgi/perl to send the image correctly without using ssi or putting the <img ..> code in the cgi/perl file?
20050419 Cleaned up by Corion: Put code in code tags.
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.