Add Content-Disposition to make saving images cleaner
When a user tries to save a file from the browser, make the filename the url they entered so they don’t have to type it again.
This commit is contained in:
parent
4abd000917
commit
745b9cc692
@ -231,11 +231,13 @@ class http2pic
|
||||
if ($this->params['type'] === 'png') {
|
||||
|
||||
header('Content-Type: image/png');
|
||||
header('Content-Disposition: inline; filename="'.$this->trimToAlphaNumeric($this->params['url']).'"');
|
||||
$result = imagecreatefrompng($this->params['file']);
|
||||
imagepng($result, NULL, 9);
|
||||
}
|
||||
else {
|
||||
header('Content-Type: image/jpeg');
|
||||
header('Content-Disposition: inline; filename="'.$this->trimToAlphaNumeric($this->params['url']).'"');
|
||||
$result = imagecreatefromjpeg($this->params['file']);
|
||||
imagejpeg($result, NULL, 100);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user