[thelist] Filename on php/gd-generated images
Burhan Khalid
thelist at meidomus.com
Sun May 29 02:18:21 CDT 2005
Maximillian Schwanekamp wrote:
> 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...
I think if you set the Content-Disposition header, it should do the trick.
header('Content-Disposition: attachment; filename="imagename.jpg"');
Headers are always hit and miss with me, so the above might not work.
More information about the thelist
mailing list