mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/8672] Use fastImageSize in classes
PHPBB3-8672
This commit is contained in:
@@ -30,7 +30,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\upload\imagesize */
|
||||
/** @var \fastImageSize\fastImageSize */
|
||||
protected $imagesize;
|
||||
|
||||
/**
|
||||
@@ -76,13 +76,13 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
|
||||
* Construct a driver object
|
||||
*
|
||||
* @param \phpbb\config\config $config phpBB configuration
|
||||
* @param \phpbb\upload\imagesize $imagesize phpBB imagesize class
|
||||
* @param \fastImageSize\fastImageSize $imagesize fastImageSize class
|
||||
* @param string $phpbb_root_path Path to the phpBB root
|
||||
* @param string $php_ext PHP file extension
|
||||
* @param \phpbb\path_helper $path_helper phpBB path helper
|
||||
* @param \phpbb\cache\driver\driver_interface $cache Cache driver
|
||||
*/
|
||||
public function __construct(\phpbb\config\config $config, \phpbb\upload\imagesize $imagesize, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\cache\driver\driver_interface $cache = null)
|
||||
public function __construct(\phpbb\config\config $config, \fastImageSize\fastImageSize $imagesize, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\cache\driver\driver_interface $cache = null)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->imagesize = $imagesize;
|
||||
|
@@ -108,7 +108,7 @@ class gravatar extends \phpbb\avatar\driver\driver
|
||||
$row['avatar_width'] = $row['avatar_height'] = min($this->config['avatar_max_width'], $this->config['avatar_max_height']);
|
||||
$url = $this->get_gravatar_url($row);
|
||||
|
||||
if (($row['avatar_width'] <= 0 || $row['avatar_height'] <= 0) && (($image_data = $this->imagesize->get_imagesize($url)) === false))
|
||||
if (($row['avatar_width'] <= 0 || $row['avatar_height'] <= 0) && (($image_data = $this->imagesize->getImageSize($url)) === false))
|
||||
{
|
||||
$error[] = 'UNABLE_GET_IMAGE_SIZE';
|
||||
return false;
|
||||
|
@@ -172,7 +172,7 @@ 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))
|
||||
{
|
||||
$dims = $this->imagesize->get_imagesize($file_path . '/' . $image);
|
||||
$dims = $this->imagesize->getImageSize($file_path . '/' . $image);
|
||||
|
||||
if ($dims === false)
|
||||
{
|
||||
|
@@ -93,7 +93,7 @@ class remote extends \phpbb\avatar\driver\driver
|
||||
}
|
||||
|
||||
// Get image dimensions
|
||||
if (($width <= 0 || $height <= 0) && (($image_data = $this->imagesize->get_imagesize($url)) === false))
|
||||
if (($width <= 0 || $height <= 0) && (($image_data = $this->imagesize->getImageSize($url)) === false))
|
||||
{
|
||||
$error[] = 'UNABLE_GET_IMAGE_SIZE';
|
||||
return false;
|
||||
|
@@ -374,8 +374,8 @@ class parser implements \phpbb\textformatter\parser_interface
|
||||
|
||||
if ($max_height || $max_width)
|
||||
{
|
||||
$imagesize = new \phpbb\upload\imagesize();
|
||||
$size_info = $imagesize->get_imagesize($url);
|
||||
$imagesize = new \fastImageSize\fastImageSize();
|
||||
$size_info = $imagesize->getImageSize($url);
|
||||
if ($size_info === false)
|
||||
{
|
||||
$logger->err('UNABLE_GET_IMAGE_SIZE');
|
||||
|
Reference in New Issue
Block a user