diff options
| author | Marc Alexander <admin@m-a-styles.de> | 2015-02-08 20:46:14 +0100 |
|---|---|---|
| committer | Marc Alexander <admin@m-a-styles.de> | 2015-04-24 13:31:36 +0200 |
| commit | 2fa99602c6f6431e99468ca13f4a58344a401c24 (patch) | |
| tree | 0be2c3641e6f9b60d69130793484c8dfff5f932b /phpBB/phpbb/avatar/driver/local.php | |
| parent | 746a33b57bf9bba645c826b596fbc54ee13d1954 (diff) | |
| download | forums-2fa99602c6f6431e99468ca13f4a58344a401c24.tar forums-2fa99602c6f6431e99468ca13f4a58344a401c24.tar.gz forums-2fa99602c6f6431e99468ca13f4a58344a401c24.tar.bz2 forums-2fa99602c6f6431e99468ca13f4a58344a401c24.tar.xz forums-2fa99602c6f6431e99468ca13f4a58344a401c24.zip | |
[ticket/8672] Add class for retrieving imagesize without download
getimagesize() always downloads the complete file before checking
the actual image dimensions. This class will be able to do the same
without having to download possibly large files.
PHPBB3-8672
Diffstat (limited to 'phpBB/phpbb/avatar/driver/local.php')
| -rw-r--r-- | phpBB/phpbb/avatar/driver/local.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index 36087f8ba0..abb07469de 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -172,13 +172,15 @@ class local extends \phpbb\avatar\driver\driver // Match all images in the gallery folder if (preg_match('#^[^&\'"<>]+\.(?:' . implode('|', $this->allowed_extensions) . ')$#i', $image) && is_file($file_path . '/' . $image)) { - if (function_exists('getimagesize')) + $dims = $this->imagesize->get_imagesize($file_path . '/' . $image); + + if ($dims === false) { - $dims = getimagesize($file_path . '/' . $image); + $dims = array(0, 0); } else { - $dims = array(0, 0); + $dims = array($dims['width'], $dims['height']); } $cat = ($path == $file_path) ? $user->lang['NO_AVATAR_CATEGORY'] : str_replace("$path/", '', $file_path); $avatar_list[$cat][$image] = array( |
