1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-25 17:23:00 +00:00

Suggest appropriate filename when saving a generated preview image. Fixes #105.

This commit is contained in:
Starbeamrainbowlabs 2016-09-11 18:12:31 +01:00
parent c37ed7ced0
commit 5eb8b7f6b4
3 changed files with 7 additions and 1 deletions

View file

@ -2941,6 +2941,9 @@ register_module([
$filepath = $env->storage_prefix . $pageindex->{$env->page}->uploadedfilepath;
$mime_type = $pageindex->{$env->page}->uploadedfilemime;
$shortFilename = substr($filepath, 1 + (strrpos($filepath, '/') !== false ? strrpos($filepath, '/') : -1));
header("content-disposition: inline; filename=\"$shortFilename\"");
// If the size is set or original, then send (or redirect to) the original image
// Also do the same for SVGs if svg rendering is disabled.

View file

@ -77,7 +77,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File\/' prefix.",
"id": "feature-upload",
"lastupdate": 1472230366,
"lastupdate": 1473613885,
"optional": false
},
{

View file

@ -245,6 +245,9 @@ register_module([
$filepath = $env->storage_prefix . $pageindex->{$env->page}->uploadedfilepath;
$mime_type = $pageindex->{$env->page}->uploadedfilemime;
$shortFilename = substr($filepath, 1 + (strrpos($filepath, '/') !== false ? strrpos($filepath, '/') : -1));
header("content-disposition: inline; filename=\"$shortFilename\"");
// If the size is set or original, then send (or redirect to) the original image
// Also do the same for SVGs if svg rendering is disabled.