From f44f0efee7d80e5b351055e1ffbfa4d1368a04a6 Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Mon, 14 Nov 2016 11:01:29 -0500 Subject: [PATCH] Fix progressive jpeg encoding. --- src/Manipulators/Encode.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Manipulators/Encode.php b/src/Manipulators/Encode.php index f15f34e2..916d5423 100644 --- a/src/Manipulators/Encode.php +++ b/src/Manipulators/Encode.php @@ -20,17 +20,17 @@ public function run(Image $image) $format = $this->getFormat($image); $quality = $this->getQuality(); - if ($format === 'pjpg') { - $image->interlace(); - $format = 'jpg'; - } - - if ($format === 'jpg') { + if (in_array($format, ['jpg', 'pjpg'], true)) { $image = $image->getDriver() ->newImage($image->width(), $image->height(), '#fff') ->insert($image, 'top-left', 0, 0); } + if ($format === 'pjpg') { + $image->interlace(); + $format = 'jpg'; + } + return $image->encode($format, $quality); }