The Intervention Image library, when initiating from a stream, loses all EXIF data with the gd driver, while it resets the Orientation EXIF tag to 0 with the Imagick driver.
The following code, used on this test image:
<?php
use Intervention\Image\ImageManager;
$driver = ['driver' => 'Imagick'];
$image_manager = new ImageManager($driver);
$image = $image_manager->make('./Landscape_3.jpg');
echo "Instantiated from file path, Imagick:\n";
echo var_export($image->exif(), TRUE);
echo "\n";
$stream = fopen('./Landscape_3.jpg', 'r');
$image = $image_manager->make($stream);
echo "Instantiated from stream, Imagick:\n";
echo var_export($image->exif(), TRUE);
echo "\n";
$driver = ['driver' => 'gd'];
$image_manager = new ImageManager($driver);
$image = $image_manager->make('./Landscape_3.jpg');
echo "Instantiated from file path, gd:\n";
echo var_export($image->exif(), TRUE);
echo "\n";
$stream = fopen('./Landscape_3.jpg', 'r');
$image = $image_manager->make($stream);
echo "Instantiated from stream, gd:\n";
echo var_export($image->exif(), TRUE);
echo "\n";
?>
Generates the following output:
Instantiated from file path, Imagick:
array (
'FileName' => 'Landscape_3.jpg',
'FileDateTime' => 1667820935,
'FileSize' => 348796,
'FileType' => 2,
'MimeType' => 'image/jpeg',
'SectionsFound' => 'ANY_TAG, IFD0',
'COMPUTED' =>
array (
'html' => 'width="1800" height="1200"',
'Height' => 1200,
'Width' => 1800,
'IsColor' => 1,
'ByteOrderMotorola' => 1,
),
'Orientation' => 3,
'XResolution' => '72/1',
'YResolution' => '72/1',
'ResolutionUnit' => 2,
'YCbCrPositioning' => 1,
)
Instantiated from stream, Imagick:
array (
'FileDateTime' => 0,
'FileSize' => 440610,
'FileType' => 2,
'MimeType' => 'image/jpeg',
'SectionsFound' => 'ANY_TAG, IFD0',
'COMPUTED' =>
array (
'html' => 'width="1800" height="1200"',
'Height' => 1200,
'Width' => 1800,
'IsColor' => 1,
'ByteOrderMotorola' => 1,
),
'Orientation' => 0,
'XResolution' => '72/1',
'YResolution' => '72/1',
'ResolutionUnit' => 2,
'YCbCrPositioning' => 1,
)
Instantiated from file path, gd:
array (
'FileName' => 'Landscape_3.jpg',
'FileDateTime' => 1667820935,
'FileSize' => 348796,
'FileType' => 2,
'MimeType' => 'image/jpeg',
'SectionsFound' => 'ANY_TAG, IFD0',
'COMPUTED' =>
array (
'html' => 'width="1800" height="1200"',
'Height' => 1200,
'Width' => 1800,
'IsColor' => 1,
'ByteOrderMotorola' => 1,
),
'Orientation' => 3,
'XResolution' => '72/1',
'YResolution' => '72/1',
'ResolutionUnit' => 2,
'YCbCrPositioning' => 1,
)
Instantiated from stream, gd:
array (
'FileDateTime' => 0,
'FileSize' => 593747,
'FileType' => 2,
'MimeType' => 'image/jpeg',
'SectionsFound' => 'COMMENT',
'COMPUTED' =>
array (
'html' => 'width="1800" height="1200"',
'Height' => 1200,
'Width' => 1800,
'IsColor' => 1,
),
'COMMENT' =>
array (
0 => 'CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), quality = 90
',
),
)
Notice how, when using a stream, the gd driver loses all EXIF data, while the Imagick driver has the Orientation wrongly set to 0.
Therefore issue 745 is still open. As the API clearly states that "Image object must be instantiated from file path to read the EXIF data correctly", this is not a bug, but it is in my opinion an important missing feature of the library.