1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-23 01:55:01 +00:00

Only display dimensions of uploaded files if they are images

This commit is contained in:
Starbeamrainbowlabs 2016-04-02 15:14:08 +01:00
parent 920aee08e7
commit bcb53c6eb7
3 changed files with 9 additions and 7 deletions

View file

@ -2506,9 +2506,10 @@ register_module([
<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>
<tr><th>Size</th><td>" . human_filesize(filesize($filepath)) . "</td></tr>";
if(substr($mime_type, strpos($mime_type, "/")) == "image")
$preview_html .= "<tr><th>Original dimensions</th><td>$dimensions[0] x $dimensions[1]</td></tr>";
$preview_html .= "<tr><th>Uploaded by</th><td>" . $pageindex->{$env->page}->lasteditor . "</td></tr></table>
<h2>Description</h2>";
$parts["{content}"] = str_replace("</h1>", "</h1>\n$preview_html", $parts["{content}"]);

View file

@ -68,7 +68,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": 1459605921,
"lastupdate": 1459606415,
"optional": false
},
{

View file

@ -278,9 +278,10 @@ register_module([
<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>
<tr><th>Size</th><td>" . human_filesize(filesize($filepath)) . "</td></tr>";
if(substr($mime_type, strpos($mime_type, "/")) == "image")
$preview_html .= "<tr><th>Original dimensions</th><td>$dimensions[0] x $dimensions[1]</td></tr>";
$preview_html .= "<tr><th>Uploaded by</th><td>" . $pageindex->{$env->page}->lasteditor . "</td></tr></table>
<h2>Description</h2>";
$parts["{content}"] = str_replace("</h1>", "</h1>\n$preview_html", $parts["{content}"]);