I'm trying to read the MimeType in the computed headers of EXIF read data but can't seem to find it, instead my loop just var dumps as if it can't find it but upon looking through the vardump i can see that Thumbnail.MimeType is indeed in the computed headers and I may be just trying to access it wrong, see code below, it accepts image upload and then uploads to a s3 bucket then I get the headers using the bucket image url.
$result = $s3->putObject([
'Bucket' => '*********',
'Key' => 'full/' . $file_name,
'SourceFile' => $temp_file_location,
'ACL' => 'public-read'
]);
$code = $result['@metadata']['statusCode'];
if ($code === 200) {
$path = "url";
}
$exif_headers = exif_read_data($path, 'EXIF');
$computed_headers = exif_read_data($path, 'COMPUTED');
//check if image has datetime original.
if (!empty($exif_headers['DateTimeOriginal'])) {
$exif_date = $exif_headers['DateTimeOriginal'];
echo $exif_date;
} else {
// if no date time original pull Thumbnail.MimeType.
if (!empty($computed_headers['Thumbnail.MimeType'])) {
$exif_mime_type = $computed_headers['Thumbnail.MimeType'];
echo $exif_mime_type;
} else { // var dump if Thumbnail.MimeType is empty.
var_dump($computed_headers);
}
}
any help would be greatly appreciated :), I feel like i am just missing something as i'm able to pull DateTimeOriginal when it is present without issues. TIA
Edit: here is the var dump
array(21) {
["FileName"]=> string(67) "5dce8027494055dce756d6bce615ACDD56-0BF6-4754-
BA08-C5FD4E0C38EC.jpeg"
["FileDateTime"]=> int(0)
["FileSize"]=> int(1309255)
["FileType"]=> int(2)
["MimeType"]=> string(10) "image/jpeg"
["SectionsFound"]=> string(30) "ANY_TAG, IFD0, THUMBNAIL, EXIF"
["COMPUTED"]=> array(7) {
["html"]=> string(26) "width="3264" height="2448""
["Height"]=> int(2448)
["Width"]=> int(3264)
["IsColor"]=> int(1)
["ByteOrderMotorola"]=> int(1)
["Thumbnail.FileType"]=> int(2)
["Thumbnail.MimeType"]=> string(10) "image/jpeg" }
["Orientation"]=> int(1)
["XResolution"]=> string(4) "72/1"
["YResolution"]=> string(4) "72/1"
["ResolutionUnit"]=> int(2)
["YCbCrPositioning"]=> int(1)
["Exif_IFD_Pointer"]=> int(102)
["THUMBNAIL"]=> array(6) {
["Compression"]=> int(6)
["XResolution"]=> string(4) "72/1"
["YResolution"]=> string(4) "72/1"
["ResolutionUnit"]=> int(2)
["JPEGInterchangeFormat"]=> int(286)
["JPEGInterchangeFormatLength"]=> int(7063)
}
["ExifVersion"]=> string(4) "0221"
["ComponentsConfiguration"]=> string(4) ""
["FlashPixVersion"]=> string(4) "0100"
["ColorSpace"]=> int(1)
["ExifImageWidth"]=> int(3264)
["ExifImageLength"]=> int(2448)
["SceneCaptureType"]=> int(0)
}