Skip to content

Add OffsetTime* Exif tags #18237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ext/exif/exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ static char *exif_get_tagformat(int format)
#define TAG_EXIFVERSION 0x9000
#define TAG_DATE_TIME_ORIGINAL 0x9003
#define TAG_DATE_TIME_DIGITIZED 0x9004
#define TAG_OFFSET_TIME 0x9010
#define TAG_OFFSET_TIME_ORIGINAL 0x9011
#define TAG_OFFSET_TIME_DIGITIZED 0x9012
#define TAG_COMPONENT_CONFIG 0x9101
#define TAG_COMPRESSED_BITS_PER_PIXEL 0x9102
#define TAG_SHUTTERSPEED 0x9201
Expand Down Expand Up @@ -692,6 +695,9 @@ static tag_info_array tag_table_IFD = {
{ 0x9000, "ExifVersion"},
{ 0x9003, "DateTimeOriginal"},
{ 0x9004, "DateTimeDigitized"},
{ 0x9010, "OffsetTime"},
{ 0x9011, "OffsetTimeOriginal"},
{ 0x9012, "OffsetTimeDigitized"},
{ 0x9101, "ComponentsConfiguration"},
{ 0x9102, "CompressedBitsPerPixel"},
{ 0x9201, "ShutterSpeedValue"},
Expand Down
59 changes: 59 additions & 0 deletions ext/exif/tests/exif028.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
--TEST--
Check for exif_read_data, JPEG with IFD data containg OffsetTime, OffsetTimeOriginal, and OffsetTimeDigitized tags in Motorola byte-order.
--EXTENSIONS--
exif
--INI--
output_handler=
zlib.output_compression=0
--FILE--
<?php
var_dump(exif_read_data(__DIR__.'/image028.jpg'));
?>
--EXPECTF--
array(17) {
["FileName"]=>
string(12) "image028.jpg"
["FileDateTime"]=>
int(%d)
["FileSize"]=>
int(%d)
["FileType"]=>
int(2)
["MimeType"]=>
string(10) "image/jpeg"
["SectionsFound"]=>
string(13) "ANY_TAG, IFD0"
["COMPUTED"]=>
array(5) {
["html"]=>
string(20) "width="1" height="1""
["Height"]=>
int(1)
["Width"]=>
int(1)
["IsColor"]=>
int(1)
["ByteOrderMotorola"]=>
int(1)
}
["XResolution"]=>
string(5) "300/1"
["YResolution"]=>
string(5) "300/1"
["ResolutionUnit"]=>
int(2)
["DateTime"]=>
string(19) "2025:04:03 00:02:00"
["YCbCrPositioning"]=>
int(1)
["DateTimeOriginal"]=>
string(19) "2025:04:03 00:00:00"
["DateTimeDigitized"]=>
string(19) "2025:04:03 00:01:00"
["OffsetTime"]=>
string(6) "-02:00"
["OffsetTimeOriginal"]=>
string(6) "+00:00"
["OffsetTimeDigitized"]=>
string(6) "-01:00"
}
Binary file added ext/exif/tests/image028.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading