mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +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
|
# All uploaded files
|
||||||
build/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
|
// We are looking at a page that is paired with an uploaded file
|
||||||
$filepath = $pageindex->{$env->page}->uploadedfilepath;
|
$filepath = $pageindex->{$env->page}->uploadedfilepath;
|
||||||
$mime_type = $pageindex->{$env->page}->uploadedfilemime;
|
$mime_type = $pageindex->{$env->page}->uploadedfilemime;
|
||||||
|
$dimensions = getimagesize($env->storage_prefix . $filepath);
|
||||||
$image_link = "//" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["SCRIPT_NAME"]) . $filepath;
|
$image_link = "//" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["SCRIPT_NAME"]) . $filepath;
|
||||||
if($env->storage_prefix !== "./")
|
if($env->storage_prefix !== "./")
|
||||||
$image_link = "?action=preview&size=original&page=" . rawurlencode($env->page);
|
$image_link = "?action=preview&size=original&page=" . rawurlencode($env->page);
|
||||||
|
|
||||||
|
|
||||||
$preview_sizes = [ 256, 512, 768, 1024, 1536 ];
|
$preview_sizes = [ 256, 512, 768, 1024, 1536 ];
|
||||||
$preview_html = "<figure class='preview'>
|
$preview_html = "<figure class='preview'>
|
||||||
<img src='?action=preview&size=$settings->default_preview_size&page=" . rawurlencode($env->page) . "' />
|
<img src='?action=preview&size=$settings->default_preview_size&page=" . rawurlencode($env->page) . "' />
|
||||||
|
@ -2089,13 +2091,13 @@ register_module([
|
||||||
<li>Other Sizes: ";
|
<li>Other Sizes: ";
|
||||||
foreach($preview_sizes as $size)
|
foreach($preview_sizes as $size)
|
||||||
$preview_html .= "<a href='?action=preview&size='$size>$size" . "px</a> ";
|
$preview_html .= "<a href='?action=preview&size='$size>$size" . "px</a> ";
|
||||||
$preview_html .= "</li>
|
$preview_html .= "</li></ul></nav>
|
||||||
<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>
|
|
||||||
</figure>
|
</figure>
|
||||||
<h2>File Information</h2>
|
<h2>File Information</h2>
|
||||||
<table><tr><th>Name</th><td>" . str_replace("File/", "", $filepath) . "</td>
|
<table><tr><th>Name</th><td>" . str_replace("File/", "", $filepath) . "</td>
|
||||||
<tr><th>Type</th><td>$mime_type</td></tr>
|
<tr><th>Type</th><td>$mime_type</td></tr>
|
||||||
<tr><th>Size</th><td>" . human_filesize(filesize($filepath)) . "</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>
|
<tr><th>Uploaded by</th><td>" . $pageindex->{$env->page}->lasteditor . "</td></tr></table>
|
||||||
<h2>Description</h2>";
|
<h2>Description</h2>";
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,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": 1447002760,
|
"lastupdate": 1447053195,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -234,10 +234,12 @@ register_module([
|
||||||
// We are looking at a page that is paired with an uploaded file
|
// We are looking at a page that is paired with an uploaded file
|
||||||
$filepath = $pageindex->{$env->page}->uploadedfilepath;
|
$filepath = $pageindex->{$env->page}->uploadedfilepath;
|
||||||
$mime_type = $pageindex->{$env->page}->uploadedfilemime;
|
$mime_type = $pageindex->{$env->page}->uploadedfilemime;
|
||||||
|
$dimensions = getimagesize($env->storage_prefix . $filepath);
|
||||||
$image_link = "//" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["SCRIPT_NAME"]) . $filepath;
|
$image_link = "//" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["SCRIPT_NAME"]) . $filepath;
|
||||||
if($env->storage_prefix !== "./")
|
if($env->storage_prefix !== "./")
|
||||||
$image_link = "?action=preview&size=original&page=" . rawurlencode($env->page);
|
$image_link = "?action=preview&size=original&page=" . rawurlencode($env->page);
|
||||||
|
|
||||||
|
|
||||||
$preview_sizes = [ 256, 512, 768, 1024, 1536 ];
|
$preview_sizes = [ 256, 512, 768, 1024, 1536 ];
|
||||||
$preview_html = "<figure class='preview'>
|
$preview_html = "<figure class='preview'>
|
||||||
<img src='?action=preview&size=$settings->default_preview_size&page=" . rawurlencode($env->page) . "' />
|
<img src='?action=preview&size=$settings->default_preview_size&page=" . rawurlencode($env->page) . "' />
|
||||||
|
@ -246,13 +248,13 @@ register_module([
|
||||||
<li>Other Sizes: ";
|
<li>Other Sizes: ";
|
||||||
foreach($preview_sizes as $size)
|
foreach($preview_sizes as $size)
|
||||||
$preview_html .= "<a href='?action=preview&size='$size>$size" . "px</a> ";
|
$preview_html .= "<a href='?action=preview&size='$size>$size" . "px</a> ";
|
||||||
$preview_html .= "</li>
|
$preview_html .= "</li></ul></nav>
|
||||||
<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>
|
|
||||||
</figure>
|
</figure>
|
||||||
<h2>File Information</h2>
|
<h2>File Information</h2>
|
||||||
<table><tr><th>Name</th><td>" . str_replace("File/", "", $filepath) . "</td>
|
<table><tr><th>Name</th><td>" . str_replace("File/", "", $filepath) . "</td>
|
||||||
<tr><th>Type</th><td>$mime_type</td></tr>
|
<tr><th>Type</th><td>$mime_type</td></tr>
|
||||||
<tr><th>Size</th><td>" . human_filesize(filesize($filepath)) . "</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>
|
<tr><th>Uploaded by</th><td>" . $pageindex->{$env->page}->lasteditor . "</td></tr></table>
|
||||||
<h2>Description</h2>";
|
<h2>Description</h2>";
|
||||||
|
|
||||||
|
|
|
@ -43,10 +43,10 @@ $settings->sitesecret = "ed420502615bac9037f8f12abd4c9f02";
|
||||||
|
|
||||||
// The directory in which to store all files, except this main index.php.
|
// The directory in which to store all files, except this main index.php.
|
||||||
// A single dot ('.') denotes the current directory.
|
// 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.
|
// automatically by Pepperminty Wiki.
|
||||||
// Note that this setting is currently experimental.
|
// 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
|
// Determined whether edit is enabled. Set to false to disable disting for all
|
||||||
// users (anonymous or otherwise).
|
// users (anonymous or otherwise).
|
||||||
|
|
Loading…
Reference in a new issue