Bugfix: Check imagesize correctly

This commit is contained in:
Starbeamrainbowlabs 2015-10-22 08:47:21 +01:00
parent e09533659a
commit 15885200eb
3 changed files with 5 additions and 5 deletions

View File

@ -1290,9 +1290,9 @@ register_module([
case "image":
$extra_data = [];
$imagesize = getimagesize($temp_filename, $extra_data);
var_dump($imagesize);
// Make sure that the image size is defined
if(!is_int($imagesize[0]) or !is_int($imagesize))
if(!is_int($imagesize[0]) or !is_int($imagesize[1]))
exit(page_renderer::render("Upload Error - $settings->sitename", "<p>The file that you uploaded doesn't appear to be an image. $settings->sitename currently only supports uploading images (videos coming soon). <a href='?action=upload'>Go back to try again</a>.</p>"));
break;

View File

@ -50,7 +50,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": 1445499882,
"lastupdate": 1445500026,
"optional": false
},
{

View File

@ -72,9 +72,9 @@ register_module([
case "image":
$extra_data = [];
$imagesize = getimagesize($temp_filename, $extra_data);
var_dump($imagesize);
// Make sure that the image size is defined
if(!is_int($imagesize[0]) or !is_int($imagesize))
if(!is_int($imagesize[0]) or !is_int($imagesize[1]))
exit(page_renderer::render("Upload Error - $settings->sitename", "<p>The file that you uploaded doesn't appear to be an image. $settings->sitename currently only supports uploading images (videos coming soon). <a href='?action=upload'>Go back to try again</a>.</p>"));
break;