Closed ghost closed 2 years ago
Imagine won't save a jpeg file with jfif extension although the library is able to crop the file.
1.2.1
7.2.17-1
gd
GD Support => enabled GD headers Version => 2.2.5 GD library Version => 2.2.5
Example file : imagetest.tar.gz (it's tar gz as github doesn't accept jfif images)
$stream = fopen($filename, 'r'); $imagine = new Imagine\Gd\Imagine(); $image = $imagine->read($stream); $manipulator = $image->copy(); $box = new Box(300,300); $manipulator = $manipulator->thumbnail($box); $manipulator->save(__DIR__ . '/altered-' . basename($filename));
Replace \Imagine\Gd\Image::normalizeFormat() by
\Imagine\Gd\Image::normalizeFormat()
private function normalizeFormat($format) { $format = strtolower($format); if ('jpg' === $format || 'pjpeg' === $format || 'jfif' === $format) { $format = 'jpeg'; } return $format; }
@sylvain-msl-talkspirit what about submitting a pull request?
Fixed by #727
Issue description
Imagine won't save a jpeg file with jfif extension although the library is able to crop the file.
What version of Imagine are you using?
1.2.1
What's the PHP version you are using?
7.2.17-1
What's the imaging library you are using [gd/imagick/gmagick/any]?
gd
What's the imaging library configuration
GD Support => enabled GD headers Version => 2.2.5 GD library Version => 2.2.5
Minimal PHP code to reproduce the error:
Example file : imagetest.tar.gz (it's tar gz as github doesn't accept jfif images)
Proposed solution
Replace
\Imagine\Gd\Image::normalizeFormat()
by