in reply to Re^3: Broken image link when calling CGI from img tag
in thread Broken image link when calling CGI from img tag

I was hoping there would be some generic guidelines on how to handle dynamic image generation and img tags but anyway, in short after the image is generated by an external process the script that generates the image contains the following code:

if (-e $IMAGEFILE) { print $query->redirect($IMAGEFILE); exit; }

And as mentioned previously, the perl script is called via an img tag.

Replies are listed 'Best First'.
Re^5: Broken image link when calling CGI from img tag
by moritz (Cardinal) on Jul 26, 2010 at 09:45 UTC
    The general mechanism is to wait for the external program, and only then print the redirect.
    Perl 6 - links to (nearly) everything that is Perl 6.
      So will putting the correct logic in the Perl CGI script to wait will stop a broken link being shown in the img tag of the HTML document that calls the Perl script in the first place? As I posted previously, existence for the file is checked before calling the redirect.
        As I posted previously, existence for the file is checked before calling the redirect.

        But you haven't shown what happens if the file doesn't exist. You haven't told us if there are any mechanisms on your system that might delete files.

        All in all you told us little about your system (and most importantly, have shown us little actualy code), and haven't headed the advice to look into the access and error logs.

        Asking general questions to solve a specific problem seems rather inefficient to me.

        Perl 6 - links to (nearly) everything that is Perl 6.
Re^5: Broken image link when calling CGI from img tag
by Anonymous Monk on Jul 26, 2010 at 08:17 UTC
    I was hoping there would be some generic guidelines on how to handle dynamic image generation and img tags but anyway

    Check the logs, check the raw http request (or check link directly without img tag). <P. Either you're not outputting the image correctly (correct headers, binmode ...), or permissions on the file are wrong, or the webserver is configured to not serve images from that directory ....