1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-21 16:13:00 +00:00

Update file upload preview display

This commit is contained in:
Starbeamrainbowlabs 2015-11-09 07:15:12 +00:00
parent 0f18dcdc82
commit 96783fb4b0
5 changed files with 14 additions and 7 deletions

3
.gitignore vendored
View file

@ -14,3 +14,6 @@ invindex.json
# All uploaded files
build/Files/*
# The testing zone for the $paths
data_test

View file

@ -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>";

View file

@ -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
},
{

View file

@ -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>";

View file

@ -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).