diff options
-rw-r--r-- | actions/upload.php | 13 | ||||
-rw-r--r-- | lib/resize.php | 9 |
2 files changed, 11 insertions, 11 deletions
diff --git a/actions/upload.php b/actions/upload.php index 8f84ea929..da8af6e69 100644 --- a/actions/upload.php +++ b/actions/upload.php @@ -49,6 +49,15 @@ $error_msgs = array();
$river_view = get_plugin_setting('river_view', 'tidypics');
+
+ $accepted_formats = array(
+ 'image/jpeg',
+ 'image/png',
+ 'image/gif',
+ 'image/pjpeg',
+ 'image/x-png',
+ );
+
foreach($_FILES as $key => $sent_file) {
@@ -58,7 +67,7 @@ $name = $sent_file['name'];
$mime = $sent_file['type'];
-
+
if ($sent_file['error']) {
array_push($not_uploaded, $sent_file['name']);
if ($sent_file['error'] == 1) {
@@ -72,7 +81,7 @@ }
//make sure file is an image
- if ($mime != 'image/jpeg' && $mime != 'image/gif' && $mime != 'image/png' && $mime != 'image/pjpeg') {
+ if (!in_array($mime, $accepted_formats)) {
array_push($not_uploaded, $sent_file['name']);
array_push($error_msgs, elgg_echo('tidypics:not_image'));
continue;
diff --git a/lib/resize.php b/lib/resize.php index e3facf614..974f32e9e 100644 --- a/lib/resize.php +++ b/lib/resize.php @@ -277,15 +277,6 @@ if (!$imgsizearray)
return false;
- $accepted_formats = array(
- 'image/jpeg' => 'jpeg',
- 'image/png' => 'png',
- 'image/gif' => 'gif'
- );
-
- // test if it's a file we can manipulate ...
- if (!array_key_exists($imgsizearray['mime'],$accepted_formats))
- return false;
// Get width and height
$width = $imgsizearray[0];
|