Skip to content

Commit f44f0ef

Browse files
committed
Fix progressive jpeg encoding.
1 parent 8107c88 commit f44f0ef

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Manipulators/Encode.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ public function run(Image $image)
2020
$format = $this->getFormat($image);
2121
$quality = $this->getQuality();
2222

23-
if ($format === 'pjpg') {
24-
$image->interlace();
25-
$format = 'jpg';
26-
}
27-
28-
if ($format === 'jpg') {
23+
if (in_array($format, ['jpg', 'pjpg'], true)) {
2924
$image = $image->getDriver()
3025
->newImage($image->width(), $image->height(), '#fff')
3126
->insert($image, 'top-left', 0, 0);
3227
}
3328

29+
if ($format === 'pjpg') {
30+
$image->interlace();
31+
$format = 'jpg';
32+
}
33+
3434
return $image->encode($format, $quality);
3535
}
3636

0 commit comments

Comments
 (0)