Skip to content

Commit bd43334

Browse files
acc987nielsdos
authored andcommitted
Add OffsetTime* Exif tags
Closes GH-18237.
1 parent 213949d commit bd43334

File tree

5 files changed

+71
-0
lines changed

5 files changed

+71
-0
lines changed

NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ PHP NEWS
6363
. Added enchant_dict_remove_from_session(). (nielsdos)
6464
. Added enchant_dict_remove(). (nielsdos)
6565

66+
- EXIF:
67+
. Add OffsetTime* Exif tags. (acc987)
68+
6669
- Fileinfo:
6770
. Upgrade to file 5.46. (nielsdos)
6871

UPGRADING

+3
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ PHP 8.5 UPGRADE NOTES
151151
- DOM:
152152
. Added Dom\Element::$outerHTML.
153153

154+
- EXIF:
155+
. Add OffsetTime* Exif tags.
156+
154157
- XSL:
155158
. The $namespace argument of XSLTProcessor::getParameter(),
156159
XSLTProcessor::setParameter() and XSLTProcessor::removeParameter()

ext/exif/exif.c

+6
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,9 @@ static char *exif_get_tagformat(int format)
420420
#define TAG_EXIFVERSION 0x9000
421421
#define TAG_DATE_TIME_ORIGINAL 0x9003
422422
#define TAG_DATE_TIME_DIGITIZED 0x9004
423+
#define TAG_OFFSET_TIME 0x9010
424+
#define TAG_OFFSET_TIME_ORIGINAL 0x9011
425+
#define TAG_OFFSET_TIME_DIGITIZED 0x9012
423426
#define TAG_COMPONENT_CONFIG 0x9101
424427
#define TAG_COMPRESSED_BITS_PER_PIXEL 0x9102
425428
#define TAG_SHUTTERSPEED 0x9201
@@ -692,6 +695,9 @@ static tag_info_array tag_table_IFD = {
692695
{ 0x9000, "ExifVersion"},
693696
{ 0x9003, "DateTimeOriginal"},
694697
{ 0x9004, "DateTimeDigitized"},
698+
{ 0x9010, "OffsetTime"},
699+
{ 0x9011, "OffsetTimeOriginal"},
700+
{ 0x9012, "OffsetTimeDigitized"},
695701
{ 0x9101, "ComponentsConfiguration"},
696702
{ 0x9102, "CompressedBitsPerPixel"},
697703
{ 0x9201, "ShutterSpeedValue"},

ext/exif/tests/exif028.phpt

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
--TEST--
2+
Check for exif_read_data, JPEG with IFD data containg OffsetTime, OffsetTimeOriginal, and OffsetTimeDigitized tags in Motorola byte-order.
3+
--EXTENSIONS--
4+
exif
5+
--INI--
6+
output_handler=
7+
zlib.output_compression=0
8+
--FILE--
9+
<?php
10+
var_dump(exif_read_data(__DIR__.'/image028.jpg'));
11+
?>
12+
--EXPECTF--
13+
array(17) {
14+
["FileName"]=>
15+
string(12) "image028.jpg"
16+
["FileDateTime"]=>
17+
int(%d)
18+
["FileSize"]=>
19+
int(%d)
20+
["FileType"]=>
21+
int(2)
22+
["MimeType"]=>
23+
string(10) "image/jpeg"
24+
["SectionsFound"]=>
25+
string(13) "ANY_TAG, IFD0"
26+
["COMPUTED"]=>
27+
array(5) {
28+
["html"]=>
29+
string(20) "width="1" height="1""
30+
["Height"]=>
31+
int(1)
32+
["Width"]=>
33+
int(1)
34+
["IsColor"]=>
35+
int(1)
36+
["ByteOrderMotorola"]=>
37+
int(1)
38+
}
39+
["XResolution"]=>
40+
string(5) "300/1"
41+
["YResolution"]=>
42+
string(5) "300/1"
43+
["ResolutionUnit"]=>
44+
int(2)
45+
["DateTime"]=>
46+
string(19) "2025:04:03 00:02:00"
47+
["YCbCrPositioning"]=>
48+
int(1)
49+
["DateTimeOriginal"]=>
50+
string(19) "2025:04:03 00:00:00"
51+
["DateTimeDigitized"]=>
52+
string(19) "2025:04:03 00:01:00"
53+
["OffsetTime"]=>
54+
string(6) "-02:00"
55+
["OffsetTimeOriginal"]=>
56+
string(6) "+00:00"
57+
["OffsetTimeDigitized"]=>
58+
string(6) "-01:00"
59+
}

ext/exif/tests/image028.jpg

527 Bytes
Loading

0 commit comments

Comments
 (0)