mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-03 07:18:08 +02:00
[ticket/15769] Minor clean up of avatar cropping
PHPBB3-15769
This commit is contained in:
@@ -24,7 +24,7 @@ use phpbb\storage\exception\exception as storage_exception;
|
|||||||
use phpbb\storage\storage;
|
use phpbb\storage\storage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles avatars uploaded to the board
|
* Handles avatars uploaded to the board.
|
||||||
*/
|
*/
|
||||||
class upload extends \phpbb\avatar\driver\driver
|
class upload extends \phpbb\avatar\driver\driver
|
||||||
{
|
{
|
||||||
@@ -241,7 +241,6 @@ class upload extends \phpbb\avatar\driver\driver
|
|||||||
*/
|
*/
|
||||||
public function delete($row)
|
public function delete($row)
|
||||||
{
|
{
|
||||||
|
|
||||||
$error = array();
|
$error = array();
|
||||||
$prefix = $this->config['avatar_salt'] . '_';
|
$prefix = $this->config['avatar_salt'] . '_';
|
||||||
$ext = substr(strrchr($row['avatar'], '.'), 1);
|
$ext = substr(strrchr($row['avatar'], '.'), 1);
|
||||||
|
@@ -213,7 +213,7 @@ class image_cropper
|
|||||||
$flip_mode |= $flip_horizontally ? IMG_FLIP_HORIZONTAL : 0;
|
$flip_mode |= $flip_horizontally ? IMG_FLIP_HORIZONTAL : 0;
|
||||||
$flip_mode |= $flip_vertically ? IMG_FLIP_VERTICAL : 0;
|
$flip_mode |= $flip_vertically ? IMG_FLIP_VERTICAL : 0;
|
||||||
|
|
||||||
if ($flip_mode !== 0)
|
if (0 !== $flip_mode)
|
||||||
{
|
{
|
||||||
imageflip($image, $flip_mode);
|
imageflip($image, $flip_mode);
|
||||||
}
|
}
|
||||||
@@ -249,13 +249,11 @@ class image_cropper
|
|||||||
*/
|
*/
|
||||||
public static function crop_image($image, int $x, int $y, int $width, int $height)
|
public static function crop_image($image, int $x, int $y, int $width, int $height)
|
||||||
{
|
{
|
||||||
$new_image = imagecrop($image, [
|
return false !== ($new_image = imagecrop($image, [
|
||||||
'x' => $x,
|
'x' => $x,
|
||||||
'y' => $y,
|
'y' => $y,
|
||||||
'width' => $width,
|
'width' => $width,
|
||||||
'height' => $height,
|
'height' => $height,
|
||||||
]);
|
])) ? $new_image : $image;
|
||||||
|
|
||||||
return false !== $new_image ? $new_image : $image;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user