The image IS getting generated just fine

You've said that before, but never mentioned when it is generated just fine. Which is kinda important, when it comes to timing issues.

(Note that a check with -e only checks if the file itself exists, not if it is fully written, a valid image, and readable.)

I am not sure what measures to take to make the image load the first time the page is loaded.

Point is, if the image is generated in time for the page load, there shouldn't be any measures to take. Which means that something's going wrong, and so far there's no conclusive explanation of how and why stuff fails.

And fixing results when you don't know what's wrong is like trying to hunt birds, blind-folded and with only a sling.

I also mentioned the code works on Apache, but not IIS.

You did, but that doesn't necessarily give us a clue about what's wrong, or how to fix it.

One thing you can do is to run the a client request, including image loading, both through Apache and IIS, and record the TCP streams. Then you can compare the two, and learn at which level they differ, and why the browser doesn't display the image.

Perl 6 - links to (nearly) everything that is Perl 6.

In reply to Re^9: Broken image link when calling CGI from img tag by moritz
in thread Broken image link when calling CGI from img tag by lintunen

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.