24 $info = &$this->getid3->info;
26 $info[
'fileformat'] =
'jpg';
27 $info[
'video'][
'dataformat'] =
'jpg';
28 $info[
'video'][
'lossless'] =
false;
29 $info[
'video'][
'bits_per_sample'] = 24;
30 $info[
'video'][
'pixel_aspect_ratio'] = (float) 1;
36 list($width, $height, $type) = getimagesize(
$info[
'filenamepath'], $imageinfo);
39 if (isset($imageinfo[
'APP13'])) {
42 $iptc_parsed = iptcparse($imageinfo[
'APP13']);
43 if (is_array($iptc_parsed)) {
44 foreach ($iptc_parsed as $iptc_key_raw => $iptc_values) {
45 list($iptc_record, $iptc_tagkey) = explode(
'#', $iptc_key_raw);
46 $iptc_tagkey = intval(ltrim($iptc_tagkey,
'0'));
47 foreach ($iptc_values as $key => $value) {
50 if (isset(
$info[
'iptc'][
'comments'][$IPTCrecordName][$IPTCrecordTagName])) {
51 $info[
'iptc'][
'comments'][$IPTCrecordName][$IPTCrecordTagName][] = $value;
53 $info[
'iptc'][
'comments'][$IPTCrecordName][$IPTCrecordTagName] = array($value);
63 $info[
'video'][
'resolution_x'] = $width;
64 $info[
'video'][
'resolution_y'] = $height;
66 if (isset($imageinfo[
'APP1'])) {
67 if (function_exists(
'exif_read_data')) {
68 if (substr($imageinfo[
'APP1'], 0, 4) ==
'Exif') {
71 $info[
'jpg'][
'exif'] = exif_read_data(
$info[
'filenamepath'], null,
true,
false);
73 $info[
'warning'][] =
'exif_read_data() cannot parse non-EXIF data in APP1 (expected "Exif", found "'.substr($imageinfo[
'APP1'], 0, 4).
'")';
76 $info[
'warning'][] =
'EXIF parsing only available when '.(GETID3_OS_ISWINDOWS ?
'php_exif.dll enabled' :
'compiled with --enable-exif');
87 $cast_as_appropriate_keys = array(
'EXIF',
'IFD0',
'THUMBNAIL');
88 foreach ($cast_as_appropriate_keys as $exif_key) {
89 if (isset(
$info[
'jpg'][
'exif'][$exif_key])) {
90 foreach (
$info[
'jpg'][
'exif'][$exif_key] as $key => $value) {
97 if (isset(
$info[
'jpg'][
'exif'][
'GPS'])) {
99 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSVersion'])) {
100 for ($i = 0; $i < 4; $i++) {
101 $version_subparts[$i] = ord(substr(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSVersion'], $i, 1));
103 $info[
'jpg'][
'exif'][
'GPS'][
'computed'][
'version'] =
'v'.implode(
'.', $version_subparts);
106 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSDateStamp'])) {
107 $explodedGPSDateStamp = explode(
':',
$info[
'jpg'][
'exif'][
'GPS'][
'GPSDateStamp']);
108 $computed_time[5] = (isset($explodedGPSDateStamp[0]) ? $explodedGPSDateStamp[0] :
'');
109 $computed_time[3] = (isset($explodedGPSDateStamp[1]) ? $explodedGPSDateStamp[1] :
'');
110 $computed_time[4] = (isset($explodedGPSDateStamp[2]) ? $explodedGPSDateStamp[2] :
'');
112 $computed_time = array(0=>0, 1=>0, 2=>0, 3=>0, 4=>0, 5=>0);
113 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSTimeStamp']) && is_array(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSTimeStamp'])) {
114 foreach (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSTimeStamp'] as $key => $value) {
118 $info[
'jpg'][
'exif'][
'GPS'][
'computed'][
'timestamp'] = gmmktime($computed_time[0], $computed_time[1], $computed_time[2], $computed_time[3], $computed_time[4], $computed_time[5]);
121 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLatitude']) && is_array(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLatitude'])) {
122 $direction_multiplier = ((isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLatitudeRef']) && (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLatitudeRef'] ==
'S')) ? -1 : 1);
123 foreach (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLatitude'] as $key => $value) {
126 $info[
'jpg'][
'exif'][
'GPS'][
'computed'][
'latitude'] = $direction_multiplier * ($computed_latitude[0] + ($computed_latitude[1] / 60) + ($computed_latitude[2] / 3600));
129 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLongitude']) && is_array(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLongitude'])) {
130 $direction_multiplier = ((isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLongitudeRef']) && (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLongitudeRef'] ==
'W')) ? -1 : 1);
131 foreach (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLongitude'] as $key => $value) {
134 $info[
'jpg'][
'exif'][
'GPS'][
'computed'][
'longitude'] = $direction_multiplier * ($computed_longitude[0] + ($computed_longitude[1] / 60) + ($computed_longitude[2] / 3600));
136 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSAltitudeRef'])) {
137 $info[
'jpg'][
'exif'][
'GPS'][
'GPSAltitudeRef'] = ord(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSAltitudeRef']);
139 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSAltitude'])) {
140 $direction_multiplier = (!empty(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSAltitudeRef']) ? -1 : 1);
148 if (isset(
$info[
'filenamepath'])) {
150 $xmp_raw = $image_xmp->getAllTags();
151 foreach ($xmp_raw as $key => $value) {
152 if (strpos($key,
':')) {
153 list($subsection, $tagname) = explode(
':', $key);
156 $info[
'warning'][] =
'XMP: expecting "<subsection>:<tagname>", found "'.$key.
'"';
162 unset(
$info[
'fileformat']);
IPTCrecordName($iptc_record)
static DecimalizeFraction($fraction)
IPTCrecordTagName($iptc_record, $iptc_tagkey)
getID3() by James Heinrich info@getid3.org //
fseek($bytes, $whence=SEEK_SET)
CastAsAppropriate($value)
IncludeDependency($filename, $sourcefile, $DieOnFailure=false)