Hyperlink image previews to original image - fixes #153.

This commit is contained in:
Starbeamrainbowlabs 2018-04-07 13:38:45 +01:00
parent 7317e2e2b7
commit 259b866ec9
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
4 changed files with 9 additions and 6 deletions

View File

@ -7,7 +7,8 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- [Rest API] Added support for the `mode` parameter to the `random` action. - [Rest API] Added support for the `mode` parameter to the `random` action.
- Fixed various issues with both the module api & the rest api docs. - Fixed various issues with both the module api & the rest api docs.
- Add json support to the search action :D - Add json support to the search action :D
- Added page moves to the recent changes page (#151). - Added page moves to the recent changes page (#151)
- Hyperlinked image preview on file pages to the original image (#153)
### Fixed ### Fixed
- Properly escaped content of short code box on file pages - Properly escaped content of short code box on file pages

View File

@ -5338,11 +5338,12 @@ register_module([
if($mime_type == "application/pdf") if($mime_type == "application/pdf")
$fileTypeDisplay = "file"; $fileTypeDisplay = "file";
$originalUrl = $env->storage_prefix == "./" ? $filepath : "?action=preview&size=original&page=" . rawurlencode($env->page);
$preview_sizes = [ 256, 512, 768, 1024, 1440, 1920 ]; $preview_sizes = [ 256, 512, 768, 1024, 1440, 1920 ];
$preview_html .= "\t\t\t<figure class='preview'> $preview_html .= "\t\t\t<figure class='preview'>
<img src='$previewUrl' /> <a href='$originalUrl'><img src='$previewUrl' /></a>
<nav class='image-controls'> <nav class='image-controls'>
<ul><li><a href='" . ($env->storage_prefix == "./" ? $filepath : "?action=preview&size=original&page=" . rawurlencode($env->page)) . "'>&#x01f304; Original $fileTypeDisplay</a></li>"; <ul><li><a href='$originalUrl'>&#x01f304; Original $fileTypeDisplay</a></li>";
if($mime_type !== "image/svg+xml") if($mime_type !== "image/svg+xml")
{ {
$preview_html .= "<li>Other Sizes: "; $preview_html .= "<li>Other Sizes: ";

View File

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

View File

@ -480,11 +480,12 @@ register_module([
if($mime_type == "application/pdf") if($mime_type == "application/pdf")
$fileTypeDisplay = "file"; $fileTypeDisplay = "file";
$originalUrl = $env->storage_prefix == "./" ? $filepath : "?action=preview&size=original&page=" . rawurlencode($env->page);
$preview_sizes = [ 256, 512, 768, 1024, 1440, 1920 ]; $preview_sizes = [ 256, 512, 768, 1024, 1440, 1920 ];
$preview_html .= "\t\t\t<figure class='preview'> $preview_html .= "\t\t\t<figure class='preview'>
<img src='$previewUrl' /> <a href='$originalUrl'><img src='$previewUrl' /></a>
<nav class='image-controls'> <nav class='image-controls'>
<ul><li><a href='" . ($env->storage_prefix == "./" ? $filepath : "?action=preview&size=original&page=" . rawurlencode($env->page)) . "'>&#x01f304; Original $fileTypeDisplay</a></li>"; <ul><li><a href='$originalUrl'>&#x01f304; Original $fileTypeDisplay</a></li>";
if($mime_type !== "image/svg+xml") if($mime_type !== "image/svg+xml")
{ {
$preview_html .= "<li>Other Sizes: "; $preview_html .= "<li>Other Sizes: ";