1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-29 21:10:31 +02:00

Merge pull request #3524 from marc1706/ticket/8672

[ticket/8672] Add class for retrieving imagesize without download
This commit is contained in:
Tristan Darricau
2015-04-27 16:26:40 +02:00
24 changed files with 221 additions and 58 deletions

View File

@@ -339,22 +339,23 @@ class bbcode_firstpass extends bbcode
if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width'])
{
$stats = @getimagesize(htmlspecialchars_decode($in));
$imagesize = new \fastImageSize\fastImageSize();
$size_info = $imagesize->getImageSize(htmlspecialchars_decode($in));
if ($stats === false)
if ($size_info === false)
{
$error = true;
$this->warn_msg[] = $user->lang['UNABLE_GET_IMAGE_SIZE'];
}
else
{
if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $stats[1])
if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $size_info['height'])
{
$error = true;
$this->warn_msg[] = $user->lang('MAX_IMG_HEIGHT_EXCEEDED', (int) $config['max_' . $this->mode . '_img_height']);
}
if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $stats[0])
if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $size_info['width'])
{
$error = true;
$this->warn_msg[] = $user->lang('MAX_IMG_WIDTH_EXCEEDED', (int) $config['max_' . $this->mode . '_img_width']);