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

The tag seems fine. I'm not much of a Perl programmer, just adminning the application so with the information I've provided on how the script works, what techniques would I need to use so that the image is generated before the HTML is displayed?
  • Comment on Re^2: Broken image link when calling CGI from img tag

Replies are listed 'Best First'.
Re^3: Broken image link when calling CGI from img tag
by moritz (Cardinal) on Jul 14, 2010 at 09:32 UTC
    what techniques would I need to use so that the image is generated before the HTML is displayed?

    Make sure that the code for the image generation is run before the code that displays the HTML (and that it's not run in the background).

    Sorry, but without more knwoledge of the structure of your code it's impossible to give more concrete instructions.

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

      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.

        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.
        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 ....