You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Mark Harrison <mh...@pixar.com> on 2007/08/17 20:41:16 UTC

giving a filename hint to the browser?

I have a module that is serving out images in various formats
and resolution.  Our canonical format is:

/operation/image/resolution

for example, to get a jpeg thumbnail of foo.tif 256 pixels:

http://myserver/thumb/foo.tif/256-wide-jpg

This is all working well now and fits in with how other parts
of our system think about images, but I'm curious if there is a
way to hint to the browser a "save-as" filename.  Currently
if you save the file (or drag the image to the desktop),
the default name will be "256-wide-jpg.jpg", and it might be
nice to save it as "foo.tif.thumbnail.jpg" or some such.

Many TIA!
Mark

Re: giving a filename hint to the browser?

Posted by Mark Harrison <mh...@pixar.com>.
Ray Morris wrote:
> Google Content-Disposition.  This is techincally a
> MAIL header, not an HTTP header, I think, but the
> major browsers seem to pay some attention to it,
> at least some times.

Ah, that's perfect.  Firefox honors it on "Save As...",
and Safari honors it on both "Save As..." and when dragging
the image to another app or the Finder.

Thanks a bunch!
Mark

For future googles:

     snprintf(disposition, sizeof(disposition), "inline; filename=%s", hint);
     apr_table_add(r->headers_out, "Content-disposition", disposition);

Re: giving a filename hint to the browser?

Posted by Ray Morris <su...@bettercgi.com>.
Google Content-Disposition.  This is techincally a
MAIL header, not an HTTP header, I think, but the
major browsers seem to pay some attention to it,
at least some times.
--
Ray B. Morris
support@bettercgi.com

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php



On 08/17/2007 01:41:16 PM, Mark Harrison wrote:
> I have a module that is serving out images in various formats
> and resolution.  Our canonical format is:
> 
> /operation/image/resolution
> 
> for example, to get a jpeg thumbnail of foo.tif 256 pixels:
> 
> http://myserver/thumb/foo.tif/256-wide-jpg
> 
> This is all working well now and fits in with how other parts
> of our system think about images, but I'm curious if there is a
> way to hint to the browser a "save-as" filename.  Currently
> if you save the file (or drag the image to the desktop),
> the default name will be "256-wide-jpg.jpg", and it might be
> nice to save it as "foo.tif.thumbnail.jpg" or some such.
> 
> Many TIA!
> Mark
>