diff options
author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-04-27 16:26:40 +0200 |
---|---|---|
committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-04-27 16:26:40 +0200 |
commit | 734b89e75cdb02ae436b03d3247cfa820e03f42c (patch) | |
tree | 8d348e342bce8db60211ec63deed795c7e5df64e /phpBB/includes/functions_upload.php | |
parent | e7d297740117e644be18e2b9793471da5697c879 (diff) | |
parent | 9088f448633ff42d767afac674324d1e26911ab6 (diff) | |
download | forums-734b89e75cdb02ae436b03d3247cfa820e03f42c.tar forums-734b89e75cdb02ae436b03d3247cfa820e03f42c.tar.gz forums-734b89e75cdb02ae436b03d3247cfa820e03f42c.tar.bz2 forums-734b89e75cdb02ae436b03d3247cfa820e03f42c.tar.xz forums-734b89e75cdb02ae436b03d3247cfa820e03f42c.zip |
Merge pull request #3524 from marc1706/ticket/8672
[ticket/8672] Add class for retrieving imagesize without download
Diffstat (limited to 'phpBB/includes/functions_upload.php')
-rw-r--r-- | phpBB/includes/functions_upload.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 78e937abea..dcc9bc4874 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -402,28 +402,28 @@ class filespec { $this->width = $this->height = 0; - if (($this->image_info = @getimagesize($this->destination_file)) !== false) - { - $this->width = $this->image_info[0]; - $this->height = $this->image_info[1]; + // Get imagesize class + $imagesize = new \fastImageSize\fastImageSize(); - if (!empty($this->image_info['mime'])) - { - $this->mimetype = $this->image_info['mime']; - } + $this->image_info = $imagesize->getImageSize($this->destination_file, $this->mimetype); + + if ($this->image_info !== false) + { + $this->width = $this->image_info['width']; + $this->height = $this->image_info['height']; // Check image type $types = fileupload::image_types(); - if (!isset($types[$this->image_info[2]]) || !in_array($this->extension, $types[$this->image_info[2]])) + if (!isset($types[$this->image_info['type']]) || !in_array($this->extension, $types[$this->image_info['type']])) { - if (!isset($types[$this->image_info[2]])) + if (!isset($types[$this->image_info['type']])) { - $this->error[] = sprintf($user->lang['IMAGE_FILETYPE_INVALID'], $this->image_info[2], $this->mimetype); + $this->error[] = $user->lang('IMAGE_FILETYPE_INVALID', $this->image_info['type'], $this->mimetype); } else { - $this->error[] = sprintf($user->lang['IMAGE_FILETYPE_MISMATCH'], $types[$this->image_info[2]][0], $this->extension); + $this->error[] = $user->lang('IMAGE_FILETYPE_MISMATCH', $types[$this->image_info['type']][0], $this->extension); } } |