43 $info = &$this->getid3->info;
45 $info[
'fileformat'] =
'jpg';
46 $info[
'video'][
'dataformat'] =
'jpg';
47 $info[
'video'][
'lossless'] =
false;
48 $info[
'video'][
'bits_per_sample'] = 24;
49 $info[
'video'][
'pixel_aspect_ratio'] = (float) 1;
51 fseek($this->getid3->fp,
$info[
'avdataoffset'], SEEK_SET);
56 if (isset($imageinfo[
'APP13'])) {
59 $iptc_parsed = iptcparse($imageinfo[
'APP13']);
60 if (is_array($iptc_parsed)) {
61 foreach ($iptc_parsed as $iptc_key_raw => $iptc_values) {
62 list($iptc_record, $iptc_tagkey) = explode(
'#', $iptc_key_raw);
63 $iptc_tagkey = intval(ltrim($iptc_tagkey,
'0'));
64 foreach ($iptc_values as $key => $value) {
67 if (isset(
$info[
'iptc'][$IPTCrecordName][$IPTCrecordTagName])) {
68 $info[
'iptc'][$IPTCrecordName][$IPTCrecordTagName][] = $value;
70 $info[
'iptc'][$IPTCrecordName][$IPTCrecordTagName] =
array($value);
80 $info[
'video'][
'resolution_x'] = $width;
81 $info[
'video'][
'resolution_y'] = $height;
83 if (isset($imageinfo[
'APP1'])) {
84 if (function_exists(
'exif_read_data')) {
85 if (substr($imageinfo[
'APP1'], 0, 4) ==
'Exif') {
86 $info[
'jpg'][
'exif'] = @exif_read_data(
$info[
'filenamepath'],
'',
true,
false);
88 $info[
'warning'][] =
'exif_read_data() cannot parse non-EXIF data in APP1 (expected "Exif", found "'.substr($imageinfo[
'APP1'], 0, 4).
'")';
91 $info[
'warning'][] =
'EXIF parsing only available when '.(GetId3Core::environmentIsWindows() ?
'php_exif.dll enabled' :
'compiled with --enable-exif');
101 $cast_as_appropriate_keys =
array(
'EXIF',
'IFD0',
'THUMBNAIL');
102 foreach ($cast_as_appropriate_keys as $exif_key) {
103 if (isset(
$info[
'jpg'][
'exif'][$exif_key])) {
104 foreach (
$info[
'jpg'][
'exif'][$exif_key] as $key => $value) {
110 if (isset(
$info[
'jpg'][
'exif'][
'GPS'])) {
112 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSVersion'])) {
113 for ($i = 0; $i < 4; $i++) {
114 $version_subparts[$i] = ord(substr(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSVersion'], $i, 1));
116 $info[
'jpg'][
'exif'][
'GPS'][
'computed'][
'version'] =
'v'.implode(
'.', $version_subparts);
119 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSDateStamp'])) {
120 $explodedGPSDateStamp = explode(
':',
$info[
'jpg'][
'exif'][
'GPS'][
'GPSDateStamp']);
121 $computed_time[5] = (isset($explodedGPSDateStamp[0]) ? $explodedGPSDateStamp[0] :
'');
122 $computed_time[3] = (isset($explodedGPSDateStamp[1]) ? $explodedGPSDateStamp[1] :
'');
123 $computed_time[4] = (isset($explodedGPSDateStamp[2]) ? $explodedGPSDateStamp[2] :
'');
125 if (function_exists(
'date_default_timezone_set')) {
126 date_default_timezone_set(
'UTC');
128 ini_set(
'date.timezone',
'UTC');
131 $computed_time =
array(0=>0, 1=>0, 2=>0, 3=>0, 4=>0, 5=>0);
132 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSTimeStamp']) && is_array(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSTimeStamp'])) {
133 foreach (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSTimeStamp'] as $key => $value) {
137 $info[
'jpg'][
'exif'][
'GPS'][
'computed'][
'timestamp'] = mktime($computed_time[0], $computed_time[1], $computed_time[2], $computed_time[3], $computed_time[4], $computed_time[5]);
140 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLatitude']) && is_array(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLatitude'])) {
141 $direction_multiplier = ((isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLatitudeRef']) && (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLatitudeRef'] ==
'S')) ? -1 : 1);
142 foreach (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLatitude'] as $key => $value) {
145 $info[
'jpg'][
'exif'][
'GPS'][
'computed'][
'latitude'] = $direction_multiplier * ($computed_latitude[0] + ($computed_latitude[1] / 60) + ($computed_latitude[2] / 3600));
148 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLongitude']) && is_array(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLongitude'])) {
149 $direction_multiplier = ((isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLongitudeRef']) && (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLongitudeRef'] ==
'W')) ? -1 : 1);
150 foreach (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSLongitude'] as $key => $value) {
153 $info[
'jpg'][
'exif'][
'GPS'][
'computed'][
'longitude'] = $direction_multiplier * ($computed_longitude[0] + ($computed_longitude[1] / 60) + ($computed_longitude[2] / 3600));
156 if (isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSAltitude'])) {
157 $direction_multiplier = ((isset(
$info[
'jpg'][
'exif'][
'GPS'][
'GPSAltitudeRef']) && (
$info[
'jpg'][
'exif'][
'GPS'][
'GPSAltitudeRef'] === chr(1))) ? -1 : 1);
163 if (class_exists(
'GetId3\\Module\\Tag\\Xmp')) {
164 if (isset(
$info[
'filenamepath'])) {
165 $image_xmp =
new Xmp(
$info[
'filenamepath']);
166 $xmp_raw = $image_xmp->getAllTags();
167 foreach ($xmp_raw as $key => $value) {
168 list($subsection, $tagname) = explode(
':', $key);
175 unset(
$info[
'fileformat']);
static GetDataImageSize($imgData, &$imageinfo)
string $tempdir
IPTCrecordTagName($iptc_record, $iptc_tagkey)
array $IPTCrecordTagName
IPTCrecordName($iptc_record)
array $IPTCrecordName
fseek($bytes, $whence=SEEK_SET)
CastAsAppropriate($value)
Create styles array
The data for the language used.
static DecimalizeFraction($fraction)