diff --git a/src/Analyzers/ColorspaceAnalyzer.php b/src/Analyzers/ColorspaceAnalyzer.php index 15322e29..243705e6 100644 --- a/src/Analyzers/ColorspaceAnalyzer.php +++ b/src/Analyzers/ColorspaceAnalyzer.php @@ -1,5 +1,7 @@ items) ? $this->items[$query] : $default; } - $query = explode('.', $query); + $query = explode('.', (string) $query); $result = $default; $items = $this->items; diff --git a/src/Colors/AbstractColor.php b/src/Colors/AbstractColor.php index be73c770..5faf773d 100644 --- a/src/Colors/AbstractColor.php +++ b/src/Colors/AbstractColor.php @@ -1,5 +1,7 @@ addFrame( - $this->encode($frame->toImage($image->driver())), + (string) $this->encode($frame->toImage($image->driver())), $frame->delay() ); } diff --git a/src/Drivers/Gd/Encoders/JpegEncoder.php b/src/Drivers/Gd/Encoders/JpegEncoder.php index e9a456cb..d6436b83 100644 --- a/src/Drivers/Gd/Encoders/JpegEncoder.php +++ b/src/Drivers/Gd/Encoders/JpegEncoder.php @@ -1,5 +1,7 @@ red * 2.55); - $green = round($this->green * 2.55); - $blue = round($this->blue * 2.55); + $red = (int) round($this->red * 2.55); + $green = (int) round($this->green * 2.55); + $blue = (int) round($this->blue * 2.55); foreach ($image as $frame) { imagefilter($frame->native(), IMG_FILTER_COLORIZE, $red, $green, $blue); diff --git a/src/Drivers/Gd/Modifiers/ColorspaceModifier.php b/src/Drivers/Gd/Modifiers/ColorspaceModifier.php index 790afcec..3881860d 100644 --- a/src/Drivers/Gd/Modifiers/ColorspaceModifier.php +++ b/src/Drivers/Gd/Modifiers/ColorspaceModifier.php @@ -1,5 +1,7 @@ getGdFont(), $line->position()->x(), $line->position()->y(), - $line, + (string) $line, $color ); } diff --git a/src/Drivers/Imagick/Analyzers/ColorspaceAnalyzer.php b/src/Drivers/Imagick/Analyzers/ColorspaceAnalyzer.php index f1aef4b1..6bebc99f 100644 --- a/src/Drivers/Imagick/Analyzers/ColorspaceAnalyzer.php +++ b/src/Drivers/Imagick/Analyzers/ColorspaceAnalyzer.php @@ -1,5 +1,7 @@ native(); - $imagick->setImageDelay($frame->delay()); + $imagick->setImageDelay( + (int) round($frame->delay() * 100) + ); + $imagick->setImageDispose($frame->dispose()); $size = $frame->size(); diff --git a/src/Drivers/Imagick/Decoders/Base64ImageDecoder.php b/src/Drivers/Imagick/Decoders/Base64ImageDecoder.php index 4f9ace41..1d788ab3 100644 --- a/src/Drivers/Imagick/Decoders/Base64ImageDecoder.php +++ b/src/Drivers/Imagick/Decoders/Base64ImageDecoder.php @@ -1,5 +1,7 @@ driver->handleInput($source)->core()->native(); - $native->setImageDelay($delay * 100); + $native->setImageDelay(intval(round($delay * 100))); $this->imagick->addImage($native); diff --git a/src/Drivers/Imagick/Encoders/AvifEncoder.php b/src/Drivers/Imagick/Encoders/AvifEncoder.php index e3e574fd..3b65b12a 100644 --- a/src/Drivers/Imagick/Encoders/AvifEncoder.php +++ b/src/Drivers/Imagick/Encoders/AvifEncoder.php @@ -1,5 +1,7 @@ size(); $frame->native()->scaleImage( - round(max(1, ($size->width() / $this->size))), - round(max(1, ($size->height() / $this->size))) + (int) round(max(1, ($size->width() / $this->size))), + (int) round(max(1, ($size->height() / $this->size))) ); $frame->native()->scaleImage($size->width(), $size->height()); diff --git a/src/Drivers/Imagick/Modifiers/PlaceModifier.php b/src/Drivers/Imagick/Modifiers/PlaceModifier.php index 6f2f164e..6851ef6e 100644 --- a/src/Drivers/Imagick/Modifiers/PlaceModifier.php +++ b/src/Drivers/Imagick/Modifiers/PlaceModifier.php @@ -1,5 +1,7 @@ lines(); - usort($lines, function ($a, $b) { - if (mb_strlen($a) === mb_strlen($b)) { + usort($lines, function (Line $a, Line $b) { + if (mb_strlen((string) $a) === mb_strlen((string) $b)) { return 0; } - return (mb_strlen($a) > mb_strlen($b)) ? -1 : 1; + return (mb_strlen((string) $a) > mb_strlen((string) $b)) ? -1 : 1; }); return $lines[0]; diff --git a/tests/CollectionTest.php b/tests/CollectionTest.php index 7df66225..76863af7 100644 --- a/tests/CollectionTest.php +++ b/tests/CollectionTest.php @@ -1,5 +1,7 @@ assertMediaType('image/jpeg', $this->image->toJpeg()); - $this->assertMediaType('image/jpeg', $this->image->toJpg()); + $this->assertMediaType('image/jpeg', (string) $this->image->toJpeg()); + $this->assertMediaType('image/jpeg', (string) $this->image->toJpg()); } public function testToJpeg2000(): void @@ -288,28 +290,28 @@ class ImageTest extends TestCase public function testToPng(): void { - $this->assertMediaType('image/png', $this->image->toPng()); + $this->assertMediaType('image/png', (string) $this->image->toPng()); } public function testToGif(): void { - $this->assertMediaType('image/gif', $this->image->toGif()); + $this->assertMediaType('image/gif', (string) $this->image->toGif()); } public function testToWebp(): void { - $this->assertMediaType('image/webp', $this->image->toWebp()); + $this->assertMediaType('image/webp', (string) $this->image->toWebp()); } public function testToBitmap(): void { - $this->assertMediaType('image/x-ms-bmp', $this->image->toBitmap()); - $this->assertMediaType('image/x-ms-bmp', $this->image->toBmp()); + $this->assertMediaType('image/x-ms-bmp', (string) $this->image->toBitmap()); + $this->assertMediaType('image/x-ms-bmp', (string) $this->image->toBmp()); } public function testToAvif(): void { - $this->assertMediaType('image/avif', $this->image->toAvif()); + $this->assertMediaType('image/avif', (string) $this->image->toAvif()); } public function testToTiff(): void diff --git a/tests/Drivers/Gd/InputHandlerTest.php b/tests/Drivers/Gd/InputHandlerTest.php index 4e8ca18c..be376803 100644 --- a/tests/Drivers/Gd/InputHandlerTest.php +++ b/tests/Drivers/Gd/InputHandlerTest.php @@ -1,5 +1,7 @@ assertMediaType('image/jpeg', $this->image->toJpeg()); - $this->assertMediaType('image/jpeg', $this->image->toJpg()); + $this->assertMediaType('image/jpeg', (string) $this->image->toJpeg()); + $this->assertMediaType('image/jpeg', (string) $this->image->toJpg()); } public function testToJpeg2000(): void { - $this->assertMediaType('image/jp2', $this->image->toJpeg2000()); - $this->assertMediaType('image/jp2', $this->image->toJp2()); + $this->assertMediaType('image/jp2', (string) $this->image->toJpeg2000()); + $this->assertMediaType('image/jp2', (string) $this->image->toJp2()); } public function testToPng(): void { - $this->assertMediaType('image/png', $this->image->toPng()); + $this->assertMediaType('image/png', (string) $this->image->toPng()); } public function testToGif(): void { - $this->assertMediaType('image/gif', $this->image->toGif()); + $this->assertMediaType('image/gif', (string) $this->image->toGif()); } public function testToWebp(): void { - $this->assertMediaType('image/webp', $this->image->toWebp()); + $this->assertMediaType('image/webp', (string) $this->image->toWebp()); } public function testToBitmap(): void { - $this->assertMediaType('image/x-ms-bmp', $this->image->toBitmap()); - $this->assertMediaType('image/x-ms-bmp', $this->image->toBmp()); + $this->assertMediaType('image/x-ms-bmp', (string) $this->image->toBitmap()); + $this->assertMediaType('image/x-ms-bmp', (string) $this->image->toBmp()); } public function testToAvif(): void { - $this->assertMediaType('image/avif', $this->image->toAvif()); + $this->assertMediaType('image/avif', (string) $this->image->toAvif()); } public function testToTiff(): void { - $this->assertMediaType('image/tiff', $this->image->toTiff()); - $this->assertMediaType('image/tiff', $this->image->toTif()); + $this->assertMediaType('image/tiff', (string) $this->image->toTiff()); + $this->assertMediaType('image/tiff', (string) $this->image->toTif()); } public function testToHeic(): void { - $this->assertMediaType('image/heic', $this->image->toHeic()); + $this->assertMediaType('image/heic', (string) $this->image->toHeic()); } public function testInvert(): void diff --git a/tests/Drivers/Imagick/InputHandlerTest.php b/tests/Drivers/Imagick/InputHandlerTest.php index ce3b3ed4..c2ee6f10 100644 --- a/tests/Drivers/Imagick/InputHandlerTest.php +++ b/tests/Drivers/Imagick/InputHandlerTest.php @@ -1,5 +1,7 @@