note 100577 modified in function.imagepng by danbrown
| From: | danbrown@php.net | Date: | Mon, 25 Oct 2010 03:46:19 +0000 |
| Subject: | note 100577 modified in function.imagepng by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173424@lists.php.net to get a copy of this message | ||
If you're generating an image dynamically based on post data and don't want to save it to
the server, sending it to be displayed can cause problems as when the person tries to save it, the
browser will request it again from the server (causing any post data to be lost and probably a
corrupted png).
The easiest way to get around this is to force it to download using the content disposition header,
for example:
<?php
header('Content-Disposition: Attachment;filename=image.png');
header('Content-type: image/png');
?>
--was--
If you're generating an image dynamically based on post data and don't want to save it to
the server, sending it to be displayed can cause problems as when the person tries to save it, the
browser will request it again from the server (causing any post data to be lost and probably a
corrupted png).
The easiest way to get around this is to force it to download using the content disposition header,
for example:
header('Content-Disposition: Attachment;filename=image.png');
header('Content-type: image/png');
http://php.net/manual/en/function.imagepng.php