Skip to content

Commit 34c950f

Browse files
authored
Merge pull request #231 from paulrrogers/fix-incorrect-gifsicle-i-option
Drop hard-coded `-i` option from Gifsicle
2 parents 558ab9d + 7b93144 commit 34c950f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Optimizers/Gifsicle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function getCommand(): string
1818
$optionString = implode(' ', $this->options);
1919

2020
return "\"{$this->binaryPath}{$this->binaryName}\" {$optionString}"
21-
.' -i '.escapeshellarg($this->imagePath)
22-
.' -o '.escapeshellarg($this->imagePath);
21+
.' '.escapeshellarg($this->imagePath)
22+
.' --output '.escapeshellarg($this->imagePath);
2323
}
2424
}

tests/OptimizerTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use Spatie\ImageOptimizer\Optimizers\Gifsicle;
34
use Spatie\ImageOptimizer\Optimizers\Jpegoptim;
45

56
it('can accept options via the constructor', function () {
@@ -52,3 +53,9 @@
5253
expect($optimizer->binaryName())
5354
->toBe('jpegoptim');
5455
});
56+
57+
it('does not hardcode Gifsicle interlace option', function () {
58+
$optimizer = new Gifsicle();
59+
$optimizer->setImagePath('my-image.gif');
60+
expect($optimizer->getCommand())->toBe("\"gifsicle\" 'my-image.gif' --output 'my-image.gif'");
61+
});

0 commit comments

Comments
 (0)