From 34e42c2812b154d9c84e8b943bdefe973d694034 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 24 Jul 2020 12:13:14 +0200 Subject: [PATCH] Fix preserveAspectRatio parameter name in ImageAdapters --- .../files/lib/system/image/adapter/GDImageAdapter.class.php | 4 ++-- .../files/lib/system/image/adapter/IImageAdapter.class.php | 4 ++-- .../files/lib/system/image/adapter/ImageAdapter.class.php | 4 ++-- .../lib/system/image/adapter/ImagickImageAdapter.class.php | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php b/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php index 6f8a873c19..00c53ef871 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php @@ -124,12 +124,12 @@ class GDImageAdapter implements IImageAdapter { /** * @inheritDoc */ - public function createThumbnail($maxWidth, $maxHeight, $obtainDimensions = true) { + public function createThumbnail($maxWidth, $maxHeight, $preserveAspectRatio = true) { $x = $y = 0; $sourceWidth = $this->width; $sourceHeight = $this->height; - if ($obtainDimensions) { + if ($preserveAspectRatio) { if ($maxWidth / $this->width < $maxHeight / $this->height) { $width = $maxWidth; $height = round($this->height * ($width / $this->width)); diff --git a/wcfsetup/install/files/lib/system/image/adapter/IImageAdapter.class.php b/wcfsetup/install/files/lib/system/image/adapter/IImageAdapter.class.php index ea60187154..4bef9df373 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/IImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/IImageAdapter.class.php @@ -38,10 +38,10 @@ interface IImageAdapter { * * @param integer $maxWidth * @param integer $maxHeight - * @param boolean $obtainDimensions + * @param boolean $preserveAspectRatio * @return mixed */ - public function createThumbnail($maxWidth, $maxHeight, $obtainDimensions = true); + public function createThumbnail($maxWidth, $maxHeight, $preserveAspectRatio = true); /** * Clips a part of currently loaded image, overwrites image resource within instance. diff --git a/wcfsetup/install/files/lib/system/image/adapter/ImageAdapter.class.php b/wcfsetup/install/files/lib/system/image/adapter/ImageAdapter.class.php index 627062443f..6b914200d2 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/ImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/ImageAdapter.class.php @@ -70,7 +70,7 @@ class ImageAdapter implements IImageAdapter { /** * @inheritDoc */ - public function createThumbnail($maxWidth, $maxHeight, $obtainDimensions = true) { + public function createThumbnail($maxWidth, $maxHeight, $preserveAspectRatio = true) { if ($maxWidth > $this->getWidth() && $maxHeight > $this->getHeight()) { throw new SystemException("Dimensions for thumbnail can not exceed image dimensions."); } @@ -78,7 +78,7 @@ class ImageAdapter implements IImageAdapter { $maxHeight = min($maxHeight, $this->getHeight()); $maxWidth = min($maxWidth, $this->getWidth()); - return $this->adapter->createThumbnail($maxWidth, $maxHeight, $obtainDimensions); + return $this->adapter->createThumbnail($maxWidth, $maxHeight, $preserveAspectRatio); } /** diff --git a/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php b/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php index fa08741c16..38754775df 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php @@ -117,14 +117,14 @@ class ImagickImageAdapter implements IImageAdapter { /** * @inheritDoc */ - public function createThumbnail($maxWidth, $maxHeight, $obtainDimensions = true) { + public function createThumbnail($maxWidth, $maxHeight, $preserveAspectRatio = true) { $thumbnail = clone $this->imagick; if ($thumbnail->getImageFormat() == 'GIF') { $thumbnail = $thumbnail->coalesceImages(); do { - if ($obtainDimensions) { + if ($preserveAspectRatio) { $thumbnail->thumbnailImage($maxWidth, $maxHeight, true); $thumbnail->setImagePage(0, 0, 0, 0); } @@ -135,7 +135,7 @@ class ImagickImageAdapter implements IImageAdapter { } while ($thumbnail->nextImage()); } - else if ($obtainDimensions) { + else if ($preserveAspectRatio) { $thumbnail->thumbnailImage($maxWidth, $maxHeight, true); } else { -- 2.20.1