Fix preserveAspectRatio parameter name in ImageAdapters
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 24 Jul 2020 10:13:14 +0000 (12:13 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 24 Jul 2020 10:13:14 +0000 (12:13 +0200)
wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php
wcfsetup/install/files/lib/system/image/adapter/IImageAdapter.class.php
wcfsetup/install/files/lib/system/image/adapter/ImageAdapter.class.php
wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php

index 6f8a873c19f568a681c998699d56d17eeb739689..00c53ef87117869c5bcdf0ca8cd88cd2dc022e35 100644 (file)
@@ -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));
index ea60187154c4d2e938ba9fc3a91b0049e22705bc..4bef9df37375c28922566fd90e7b5caff8d0644c 100644 (file)
@@ -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.
index 627062443f47bcd0d1dae7995d16666e31424dcf..6b914200d248233e2c4acc865b2c8eb1b791074c 100644 (file)
@@ -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);
        }
        
        /**
index fa08741c16e4480cc9e2b1723b042cd71b775dd8..38754775dfb48ce955cb66ace93744e92433183e 100644 (file)
@@ -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 {