( ... a web tutorial on CGI used print STDOUT)

Which web tutorial was this? In my experience a tutorial that makes a mistake like that will often make many other (more serious) mistakes and should probably be avoided.

I still don't get how my image path is fed to the show_pic.cgi

I think we all pretty much assumed that the image path would be hard-coded in the CGI program.

Must I access the database in show_pic.cgi rather than in the script that generates the html ?

Now I'm a little confused. What do you need to access the database for?

I was suggesting a program like this:

#!/usr/bin/perl use strict; use warnings; use CGI ':standard'; if (param('action') eq 'showImage') { # code to open the image file and print contents } else { # code to print the HTML page # this includes an image tag that links back to this # program with the parameter "action=showImage" }

If that's not what you're thinking of then we've been talking at cross-purposes.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg


In reply to Re: Re: Re: Re: Re: Content-type: html and images ? by davorg
in thread Content-type: html and images ? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.