[thelist] Filename on php/gd-generated images

Maximillian Schwanekamp lists at neptunewebworks.com
Tue May 24 12:58:59 CDT 2005


Joshua Olson wrote:
> You'll want to set the content-disposition header to a value such as this:
> attachment; filename=imagename.jpg

Oh yes, but that would initiate a download dialog in most browsers.  I 
should have been more clear - the script gets called by way of the src 
attribute for the image.  e.g.
<img src="check.php?name=Max+Schwanekamp&amount=900000" height="200" 
width="400" alt="Pay to the order of... etc" />

Should the user try to save that image from within the web page 
(right-click...), some browsers will give the file the default name 
"check.php" and insist that it's a php file, not an image file, which 
would confuse some users.

Misterhaan correctly guessed I'm using apache with mod_rewrite, so his 
idea is simple and clean. E.g.
RewriteEngine on
RewriteRule check.jpg check.php

Thanks though!

-- 
Maximillian Von Schwanekamp
http://www.neptunewebworks.com/



More information about the thelist mailing list