
The getExif method currently looks like this:
protected function getExif($uri) {
return exif_read_data($uri, 'EXIF');
}
I'm not sure why, but exif_read_data() always returns false on my local environment (using DrupalVM with PHP 7.2).
When I change $uri to be an actual filepath instead of a streamwrapper, it does work.
I will add a patch.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3031810-2.patch | 518 bytes | daluxz |
Comments
Comment #2
daluxz CreditAttribution: daluxz as a volunteer and at iO commentedHere's the patch.
Comment #3
nick hope CreditAttribution: nick hope commentedIn use with PHP 7.3.15 I was getting many failures with various errors such as
Warning: exif_read_data(): Error reading from file: got=x2330(=9008) != itemlen-2=x39F2(=14834) in Drupal\media_entity_image_exif\Plugin\media\Source\ImageWithExif->getExif() (line 169 of modules\custom\media_entity_image_exif\src\Plugin\media\Source\ImageWithExif.php).
and
Warning: exif_read_data(): Process tag(x0000=UndefinedTa): Illegal format code 0x0000, suppose BYTE in Drupal\media_entity_image_exif\Plugin\media\Source\ImageWithExif->getExif() (line 169 of modules\custom\media_entity_image_exif\src\Plugin\media\Source\ImageWithExif.php).
and
Warning: exif_read_data(): Invalid JPEG file in Drupal\media_entity_image_exif\Plugin\media\Source\ImageWithExif->getExif() (line 169 of modules\custom\media_entity_image_exif\src\Plugin\media\Source\ImageWithExif.php).
(Note that my version of ImageWithExif.php is now very edited, so the line numbers are unique to me)
This patch has made it much more stable for me, with no errors since I started testing it. Thank you.
(For interest, there is some related discussion with reference to the Geocoder module in this issue)
Comment #4
damienmckennaI think the errors reported in #3 are unrelated and should be examined separately.
Comment #6
damienmckennaCommitted. Thank you.