in reply to Problems with dynamic images

but I'm calling $q->header( -type => 'image/jpeg'); before reading the file data from the file to a buffer variable and then returning that data.

perldoc CGI shows that you have to print the header,

$ perl -MCGI -le"print CGI->header(qw! -type image/jpeg -nph 1!) HTTP/1.0 200 OK Server: cmdline Date: Sun, 08 Mar 2009 08:14:05 GMT Content-Type: image/jpeg
What you probably want is from CGI::Application
# add or replace the 'type' header $webapp->header_add( -type => 'image/jpeg', -attachment => 'foo.jp +g' );

I had found an article with some examples using a redirect to append a "/image.extension" onto the URL, but that might be old and probably doesn't work anymore (and seems like it was kind of a hack anyway)
It was probably a hack for browsers which ignored attachment headers.

See also overkill anti-caching CGI headers

Replies are listed 'Best First'.
Re^2: Problems with dynamic images
by ibmman (Novice) on Mar 08, 2009 at 23:04 UTC
    Thanks! Exactly what I was looking for. I figured that changing the header by manipulating the query object would have accomplished that, but apparently not. Sometimes it's sort of tough to tell what sorts of base CGI manipulations end up affecting results in CGI::Application.