diff --git a/src/Conversions/ImageGenerators/Svg.php b/src/Conversions/ImageGenerators/Svg.php index a40eb53df..881fe13ab 100644 --- a/src/Conversions/ImageGenerators/Svg.php +++ b/src/Conversions/ImageGenerators/Svg.php @@ -11,12 +11,13 @@ class Svg extends ImageGenerator { public function convert(string $file, ?Conversion $conversion = null): string { - $imageFile = pathinfo($file, PATHINFO_DIRNAME).'/'.pathinfo($file, PATHINFO_FILENAME).'.jpg'; + $imageFile = pathinfo($file, PATHINFO_DIRNAME).'/'.pathinfo($file, PATHINFO_FILENAME).'.png'; - $image = new Imagick; - $image->readImage($file); + $image = new Imagick(); $image->setBackgroundColor(new ImagickPixel('none')); - $image->setImageFormat('jpg'); + $image->readImage($file); + + $image->setImageFormat('png32'); file_put_contents($imageFile, $image); diff --git a/tests/Conversions/ImageGenerators/SvgTest.php b/tests/Conversions/ImageGenerators/SvgTest.php index fb6eebbae..9bfea5d0d 100644 --- a/tests/Conversions/ImageGenerators/SvgTest.php +++ b/tests/Conversions/ImageGenerators/SvgTest.php @@ -17,5 +17,7 @@ $imageFile = $imageGenerator->convert($media->getPath()); - expect(mime_content_type($imageFile))->toEqual('image/jpeg'); -})->skipWhenRunningLocally(); + expect(mime_content_type($imageFile))->toEqual('image/png'); + + expect((new Imagick($imageFile))->getImageAlphaChannel())->toBeTrue(); +});