Skip to content

Commit 192e643

Browse files
committed
Add a parameter to generate arrays for each EXIF section
1 parent 8ec500a commit 192e643

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/Chunk/Exif.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ private function __construct(int $offset, string $data)
1919
}
2020

2121
/**
22-
* @return null|array<string,int|string>
22+
* @param bool $sectionsAsArrays Creates separate arrays for each contained section
23+
* @return ($sectionsAsArrays is true ? null|array<string, array<string, int|string>> : null|array<string, int|string>)
2324
* @throws MissingExifExtension
2425
*/
25-
public function getParsedExif(): ?array
26+
public function getParsedExif(bool $sectionsAsArrays = true): ?array
2627
{
2728
$bytes = $this->getRawBytes();
2829
if (\strlen($bytes) === 0) {
@@ -67,6 +68,7 @@ public function getParsedExif(): ?array
6768
$jpegBody
6869
),
6970
),
71+
as_arrays: $sectionsAsArrays,
7072
);
7173

7274
// There is no known case where the call to `\exif_read_data()` can fail

0 commit comments

Comments
 (0)