From ae8df16381e513b40230074f9eb08c861d3956d6 Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Mon, 23 Dec 2024 15:03:04 +0100 Subject: [PATCH] Remove the createThumbs function in the image class --- libraries/src/Image/Image.php | 21 -------------------- tests/Unit/Libraries/Cms/Image/ImageTest.php | 20 +++++++++---------- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/libraries/src/Image/Image.php b/libraries/src/Image/Image.php index 4309ac0433651..572dd15e4c6b6 100644 --- a/libraries/src/Image/Image.php +++ b/libraries/src/Image/Image.php @@ -367,27 +367,6 @@ public function createThumbnails($thumbSizes, $creationMethod = self::SCALE_INSI return $thumbsCreated; } - /** - * Method to create thumbnails from the current image and save them to disk. It allows creation by resizing or cropping the original image. - * - * @param mixed $thumbSizes string or array of strings. Example: $thumbSizes = ['150x75','250x150']; - * @param integer $creationMethod 1-3 resize $scaleMethod | 4 create cropping - * @param string $thumbsFolder destination thumbs folder. null generates a thumbs folder in the image folder - * - * @return array - * - * @since 2.5.0 - * @throws \LogicException - * @throws \InvalidArgumentException - * - * @deprecated 4.0 will be removed in 6.0 - * Use \Joomla\CMS\Image\createThumbnails instead - */ - public function createThumbs($thumbSizes, $creationMethod = self::SCALE_INSIDE, $thumbsFolder = null) - { - return $this->createThumbnails($thumbSizes, $creationMethod, $thumbsFolder, false); - } - /** * Method to crop the current image. * diff --git a/tests/Unit/Libraries/Cms/Image/ImageTest.php b/tests/Unit/Libraries/Cms/Image/ImageTest.php index 916d7b297830f..a7edbda6288cf 100644 --- a/tests/Unit/Libraries/Cms/Image/ImageTest.php +++ b/tests/Unit/Libraries/Cms/Image/ImageTest.php @@ -884,19 +884,19 @@ public function testGenerateThumbs() } /** - * Test the Image::createThumbs method without a loaded image. + * Test the Image::createThumbnails method without a loaded image. * * @return void * - * @covers \Joomla\CMS\Image\Image::createThumbs + * @covers \Joomla\CMS\Image\Image::createThumbnails * * @since 1.1.3 */ - public function testCreateThumbsWithoutLoadedImage() + public function testcreateThumbnailsWithoutLoadedImage() { $this->expectException(\LogicException::class); - $thumbs = $this->instance->createThumbs('50x38'); + $thumbs = $this->instance->createThumbnails('50x38'); } /** @@ -904,7 +904,7 @@ public function testCreateThumbsWithoutLoadedImage() * * @return void * - * @covers \Joomla\CMS\Image\Image::createThumbs + * @covers \Joomla\CMS\Image\Image::createThumbnails * * @since 1.1.3 */ @@ -913,23 +913,23 @@ public function testGenerateThumbsWithInvalidFolder() $this->expectException(\InvalidArgumentException::class); $this->instance->loadFile($this->testFile); - $this->instance->createThumbs('50x38', Image::SCALE_INSIDE, '/foo/bar'); + $this->instance->createThumbnails('50x38', Image::SCALE_INSIDE, '/foo/bar'); } /** - * Test the Image::createThumbs method. + * Test the Image::createThumbnails method. * * @return void * - * @covers \Joomla\CMS\Image\Image::createThumbs + * @covers \Joomla\CMS\Image\Image::createThumbnails * * @since 1.1.3 */ - public function testCreateThumbs() + public function testcreateThumbnails() { $this->instance->loadFile($this->testFile); - $thumbs = $this->instance->createThumbs('50x38', Image::CROP); + $thumbs = $this->instance->createThumbnails('50x38', Image::CROP); $outFileGif = TestHelper::getValue($thumbs[0], 'path'); $a = Image::getImageFileProperties($this->testFile);