How can I serve an image with a Perl CGI script? -


My Google FU is failing me How can I use Perl to complete the previously generated image?

Example:

   gt; & Lt; Body & gt; & Lt; Img src = "getimage.pl" & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

What happens in getimage.pl?

Here you can go:

  #! / Usr / bin / perl -w my $ file = "inner-nav.gif"; My $ length = (stat ($ file)) [10]; Print "Content-Type: Image / GIF \ n"; Print "Content-Length: $ Length \ n \ n"; Binomod STDOUT; Open (FH, '& lt;', $ file) || Die "file $$ could not be opened: $!"; My $ buffer = ""; While (Read (FH, $ buffer, 10240)) {Print $ buffer; } Close (FH);  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -