-
Notifications
You must be signed in to change notification settings - Fork 532
Closed

Description
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)
$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));
Proposed solution
Replace \Imagine\Gd\Image::normalizeFormat()
by
private function normalizeFormat($format)
{
$format = strtolower($format);
if ('jpg' === $format || 'pjpeg' === $format || 'jfif' === $format) {
$format = 'jpeg';
}
return $format;
}
Metadata
Metadata
Assignees
Labels
No labels