Note that the file might have been only partially written when you check for it, for example if you have a filehandle that is still open to the image file, which still buffers data. Explicitly close or undef the filehandle to force writing all data to disk maybe before sending the HTML out that references the image.
| [reply] [d/l] |
| [reply] |
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.
| [reply] |
I had a further think about the issue and threw in a "sleep" function and as sleep allowed the page to render correctly on first load, I am guessing the issue is that the call to the piece of code that generates the image isn't completing before code execution continues.
The piece of code that generates the image file is done by passing an input file to R:
open($R, "|C:/Progra~1/R/R-2.11.0-x64/bin/R CMD BATCH " . $R_FILE) or
+die $!;
close($R);
(This line of code was ported from Linux). I have tried a few various ways to try to make execution wait the image generation to finish but perhaps I am going about it the wrong way because nothing I have tried works or that it's a problem specific to the Windows environment. Do you have any suggestions on where to go from here?
| [reply] [d/l] |
Since I don't see any progress, this will be my last reply in this thread.
You won't achieve anything as long as you don't actually understand what's going on. Which is why JavaFan and I suggested you analyze the HTTP traffic. No response from your part.
You really need to find out what the lower-level reason is for the browser not displaying any image. Is the img tag missing from the generated HTML? Does the browser attempt to load the image? What is returned? Is the content-type header for the image correct? What's the difference between the HTTP streams of the working and non-working setup?
If you don't know how to obtain that information, re-read the thread here, there have been some pointers to tools. Or ask again. But don't simply ignore them.
Since you haven't answered all of those questions, my only remaining advice is "find somebody who fixes it for you". You might need to pay some good money for that, but that's the tradeoff for not getting deep into the issue yourself.
| [reply] |
there are no errors in the error logs
So check the access log, see how many bytes were served, compare to bytes served on reload, then compare the raw HTTP | [reply] |