15 if ( ! function_exists(
'iptcparse')) {
16 throw new \Intervention\Image\Exception\NotSupportedException(
17 "Reading Iptc data is not supported by this PHP installation."
24 @getimagesize($image->dirname .
'/'. $image->basename, $info);
28 if (array_key_exists(
'APP13', $info)) {
29 $iptc = iptcparse($info[
'APP13']);
31 if (is_array($iptc)) {
32 $data[
'DocumentTitle'] = isset($iptc[
"2#005"][0]) ? $iptc[
"2#005"][0] :
null;
33 $data[
'Urgency'] = isset($iptc[
"2#010"][0]) ? $iptc[
"2#010"][0] :
null;
34 $data[
'Category'] = isset($iptc[
"2#015"][0]) ? $iptc[
"2#015"][0] :
null;
35 $data[
'Subcategories'] = isset($iptc[
"2#020"][0]) ? $iptc[
"2#020"][0] :
null;
36 $data[
'Keywords'] = isset($iptc[
"2#025"][0]) ? $iptc[
"2#025"] :
null;
37 $data[
'SpecialInstructions'] = isset($iptc[
"2#040"][0]) ? $iptc[
"2#040"][0] :
null;
38 $data[
'CreationDate'] = isset($iptc[
"2#055"][0]) ? $iptc[
"2#055"][0] :
null;
39 $data[
'AuthorByline'] = isset($iptc[
"2#080"][0]) ? $iptc[
"2#080"][0] :
null;
40 $data[
'AuthorTitle'] = isset($iptc[
"2#085"][0]) ? $iptc[
"2#085"][0] :
null;
41 $data[
'City'] = isset($iptc[
"2#090"][0]) ? $iptc[
"2#090"][0] :
null;
42 $data[
'State'] = isset($iptc[
"2#095"][0]) ? $iptc[
"2#095"][0] :
null;
43 $data[
'Country'] = isset($iptc[
"2#101"][0]) ? $iptc[
"2#101"][0] :
null;
44 $data[
'OTR'] = isset($iptc[
"2#103"][0]) ? $iptc[
"2#103"][0] :
null;
45 $data[
'Headline'] = isset($iptc[
"2#105"][0]) ? $iptc[
"2#105"][0] :
null;
46 $data[
'Source'] = isset($iptc[
"2#110"][0]) ? $iptc[
"2#110"][0] :
null;
47 $data[
'PhotoSource'] = isset($iptc[
"2#115"][0]) ? $iptc[
"2#115"][0] :
null;
48 $data[
'Copyright'] = isset($iptc[
"2#116"][0]) ? $iptc[
"2#116"][0] :
null;
49 $data[
'Caption'] = isset($iptc[
"2#120"][0]) ? $iptc[
"2#120"][0] :
null;
50 $data[
'CaptionWriter'] = isset($iptc[
"2#122"][0]) ? $iptc[
"2#122"][0] :
null;
54 if (! is_null($key) && is_array($data)) {
55 $data = array_key_exists($key, $data) ? $data[$key] :
false;