diff --git a/src/Conversions/Actions/PerformManipulationsAction.php b/src/Conversions/Actions/PerformManipulationsAction.php index 01c0d83c9..fdad211d9 100644 --- a/src/Conversions/Actions/PerformManipulationsAction.php +++ b/src/Conversions/Actions/PerformManipulationsAction.php @@ -30,7 +30,8 @@ public function execute( } $image = Image::useImageDriver(config('media-library.image_driver')) - ->load($conversionTempFile); + ->load($conversionTempFile) + ->format('jpg'); $conversion->getManipulations()->apply($image); @@ -46,7 +47,13 @@ protected function getConversionTempFileName( ): string { $directory = pathinfo($imageFile, PATHINFO_DIRNAME); - $fileName = Str::random(32)."{$conversion->getName()}.{$media->extension}"; + $extension = $media->extension; + + if ($extension === '') { + $extension = 'jpg'; + } + + $fileName = Str::random(32)."{$conversion->getName()}.{$extension}"; return "{$directory}/{$fileName}"; } diff --git a/src/Conversions/ImageGenerators/Svg.php b/src/Conversions/ImageGenerators/Svg.php index 19c5fda4c..7b512edf6 100644 --- a/src/Conversions/ImageGenerators/Svg.php +++ b/src/Conversions/ImageGenerators/Svg.php @@ -25,7 +25,7 @@ public function convert(string $file, Conversion $conversion = null): string public function requirementsAreInstalled(): bool { - return class_exists(\Imagick::class); + return class_exists(Imagick::class); } public function supportedExtensions(): Collection diff --git a/tests/Conversions/ConversionTest.php b/tests/Conversions/ConversionTest.php index 61b34eb65..34b2cb835 100644 --- a/tests/Conversions/ConversionTest.php +++ b/tests/Conversions/ConversionTest.php @@ -134,7 +134,7 @@ ->nonOptimized() ->getManipulations() ->toArray(); - ray($manipulations); + $this->assertArrayNotHasKey('optimize', $manipulations); });