[thelist] Filename on php/gd-generated images

Joshua Olson joshua at waetech.com
Tue May 24 12:45:34 CDT 2005


> -----Original Message-----
> From: Maximillian Schwanekamp
> Sent: Tuesday, May 24, 2005 1:22 PM
> 
> I've a php script (check.php) that generates an image 
> according to query 
> string params using GD, and outputs the image directly to 
> browser with 
> imagejpeg().  Works fine, but I'm wondering if someone can 
> tell me how 
> to set the filename to something other than the calling script when 
> outputting straight to browser.  So if the user saves the 
> image to their 
> local machine, the filename will be "imagename.jpg" (or 
> similar) instead 
> of "check.php".  I'm trying to avoid saving the image to filesystem...

Max,

You'll want to set the content-disposition header to a value such as this:

attachment; filename=imagename.jpg

<><><><><><><><><><>
Joshua L. Olson
WAE Tech Inc.
http://www.waetech.com/
Phone: 706.210.0168 

Monitor bandwidth usage on IIS6 in real-time:
http://www.waetech.com/services/iisbm/




More information about the thelist mailing list