So you're saving an image to a file which then you expect the webserver to pass on to the browser... You could have a problem with webserver side caching. The fact that the image filename is always the same, could have a lot to do with it.

You could try to make sure the image name is always different. Use a counter to increment a number, and use that as part of an image name. To delete old files, you could use a cron job; or you can have the parent do that, while it's waiting for the child to finish. You'll never have too many old files, that way. I hope. :-)

But my preference would be to invoke the image creating script directly from a separate CGI script (or equivalent), and send the image data directly to the browser instead of saving it to a file first. You do need to provide the appropriate content-type header, as others already have suggested, and then simply print out the image data. The parameters you now use on the command line, can be passed as part of the image URL, after a question mark, using the familiar GET URL syntax.


In reply to Re: Images built on the fly do not display by bart
in thread Images built on the fly do not display by Bukowski

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.