mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-12-22 13:45:02 +00:00
Update file upload preview display
This commit is contained in:
parent
0f18dcdc82
commit
96783fb4b0
5 changed files with 14 additions and 7 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -14,3 +14,6 @@ invindex.json
|
|||
|
||||
# All uploaded files
|
||||
build/Files/*
|
||||
|
||||
# The testing zone for the $paths
|
||||
data_test
|
||||
|
|
|
@ -2077,10 +2077,12 @@ register_module([
|
|||
// We are looking at a page that is paired with an uploaded file
|
||||
$filepath = $pageindex->{$env->page}->uploadedfilepath;
|
||||
$mime_type = $pageindex->{$env->page}->uploadedfilemime;
|
||||
$dimensions = getimagesize($env->storage_prefix . $filepath);
|
||||
$image_link = "//" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["SCRIPT_NAME"]) . $filepath;
|
||||
if($env->storage_prefix !== "./")
|
||||
$image_link = "?action=preview&size=original&page=" . rawurlencode($env->page);
|
||||
|
||||
|
||||
$preview_sizes = [ 256, 512, 768, 1024, 1536 ];
|
||||
$preview_html = "<figure class='preview'>
|
||||
<img src='?action=preview&size=$settings->default_preview_size&page=" . rawurlencode($env->page) . "' />
|
||||
|
@ -2089,13 +2091,13 @@ register_module([
|
|||
<li>Other Sizes: ";
|
||||
foreach($preview_sizes as $size)
|
||||
$preview_html .= "<a href='?action=preview&size='$size>$size" . "px</a> ";
|
||||
$preview_html .= "</li>
|
||||
<li><label class='link-display-label' for='image-link'>Link:</label> <input class='link-display' type='text' value='$image_link' title='Press CTRL + C to copy.' onclick='this.select();' readonly /></li></ul></nav>
|
||||
$preview_html .= "</li></ul></nav>
|
||||
</figure>
|
||||
<h2>File Information</h2>
|
||||
<table><tr><th>Name</th><td>" . str_replace("File/", "", $filepath) . "</td>
|
||||
<tr><th>Type</th><td>$mime_type</td></tr>
|
||||
<tr><th>Size</th><td>" . human_filesize(filesize($filepath)) . "</td></tr>
|
||||
<tr><th>Original dimensions</th><td>$dimensions[0] x $dimensions[1]</td></tr>
|
||||
<tr><th>Uploaded by</th><td>" . $pageindex->{$env->page}->lasteditor . "</td></tr></table>
|
||||
<h2>Description</h2>";
|
||||
|
||||
|
|
|
@ -59,7 +59,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": 1447002760,
|
||||
"lastupdate": 1447053195,
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
|
|
|
@ -234,10 +234,12 @@ register_module([
|
|||
// We are looking at a page that is paired with an uploaded file
|
||||
$filepath = $pageindex->{$env->page}->uploadedfilepath;
|
||||
$mime_type = $pageindex->{$env->page}->uploadedfilemime;
|
||||
$dimensions = getimagesize($env->storage_prefix . $filepath);
|
||||
$image_link = "//" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["SCRIPT_NAME"]) . $filepath;
|
||||
if($env->storage_prefix !== "./")
|
||||
$image_link = "?action=preview&size=original&page=" . rawurlencode($env->page);
|
||||
|
||||
|
||||
$preview_sizes = [ 256, 512, 768, 1024, 1536 ];
|
||||
$preview_html = "<figure class='preview'>
|
||||
<img src='?action=preview&size=$settings->default_preview_size&page=" . rawurlencode($env->page) . "' />
|
||||
|
@ -246,13 +248,13 @@ register_module([
|
|||
<li>Other Sizes: ";
|
||||
foreach($preview_sizes as $size)
|
||||
$preview_html .= "<a href='?action=preview&size='$size>$size" . "px</a> ";
|
||||
$preview_html .= "</li>
|
||||
<li><label class='link-display-label' for='image-link'>Link:</label> <input class='link-display' type='text' value='$image_link' title='Press CTRL + C to copy.' onclick='this.select();' readonly /></li></ul></nav>
|
||||
$preview_html .= "</li></ul></nav>
|
||||
</figure>
|
||||
<h2>File Information</h2>
|
||||
<table><tr><th>Name</th><td>" . str_replace("File/", "", $filepath) . "</td>
|
||||
<tr><th>Type</th><td>$mime_type</td></tr>
|
||||
<tr><th>Size</th><td>" . human_filesize(filesize($filepath)) . "</td></tr>
|
||||
<tr><th>Original dimensions</th><td>$dimensions[0] x $dimensions[1]</td></tr>
|
||||
<tr><th>Uploaded by</th><td>" . $pageindex->{$env->page}->lasteditor . "</td></tr></table>
|
||||
<h2>Description</h2>";
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ $settings->sitesecret = "ed420502615bac9037f8f12abd4c9f02";
|
|||
|
||||
// The directory in which to store all files, except this main index.php.
|
||||
// A single dot ('.') denotes the current directory.
|
||||
// Remember to leave the trailing slash from the directory name, as it is added
|
||||
// Remember to omit the trailing slash from the directory name, as it is added
|
||||
// automatically by Pepperminty Wiki.
|
||||
// Note that this setting is currently experimental.
|
||||
$settings->data_storage_dir = ".";
|
||||
$settings->data_storage_dir = "../data_test";
|
||||
|
||||
// Determined whether edit is enabled. Set to false to disable disting for all
|
||||
// users (anonymous or otherwise).
|
||||
|
|
Loading…
Reference in a new issue