Skip to content

Commit bf7807c

Browse files
authored
Merge pull request #5969 from kenjis/fix-images-convert
fix: GDHandler::convert() does not work
2 parents d554e20 + 19f401c commit bf7807c

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

system/Images/Handlers/BaseHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ public function crop(?int $width = null, ?int $height = null, ?int $x = null, ?i
296296
*/
297297
public function convert(int $imageType)
298298
{
299+
$this->ensureResource();
300+
299301
$this->image()->imageType = $imageType;
300302

301303
return $this;

tests/system/Images/GDHandlerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ public function testImageCompressionWithResource()
394394
public function testImageConvert()
395395
{
396396
$this->handler->withFile($this->origin . 'ci-logo.jpeg');
397-
$this->handler->getResource(); // make sure resource is loaded
398397
$this->handler->convert(IMAGETYPE_PNG);
399398
$this->handler->save($this->start . 'work/ci-logo.png');
400399
$this->assertSame(exif_imagetype($this->start . 'work/ci-logo.png'), IMAGETYPE_PNG);

tests/system/Images/ImageMagickHandlerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ public function testImageCompressionWithResource()
392392
public function testImageConvert()
393393
{
394394
$this->handler->withFile($this->origin . 'ci-logo.jpeg');
395-
$this->handler->getResource(); // make sure resource is loaded
396395
$this->handler->convert(IMAGETYPE_PNG);
397396
$this->handler->save($this->root . 'ci-logo.png');
398397
$this->assertSame(exif_imagetype($this->root . 'ci-logo.png'), IMAGETYPE_PNG);

0 commit comments

Comments
 (0)