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']);
190 if (is_array($value)) {
192 } elseif (preg_match(
'#^[0-9]+/[0-9]+$#', $value)) {
194 } elseif (preg_match(
'#^[0-9]+$#', $value)) {
196 } elseif (preg_match(
'#^[0-9\.]+$#', $value)) {
197 return (
float) $value;
212 static $IPTCrecordName =
array();
213 if (empty($IPTCrecordName)) {
214 $IPTCrecordName =
array(
216 2 =>
'IPTCApplication',
217 3 =>
'IPTCNewsPhoto',
218 7 =>
'IPTCPreObjectData',
219 8 =>
'IPTCObjectData',
220 9 =>
'IPTCPostObjectData',
224 return (isset($IPTCrecordName[$iptc_record]) ? $IPTCrecordName[$iptc_record] :
'');
237 static $IPTCrecordTagName =
array();
238 if (empty($IPTCrecordTagName)) {
239 $IPTCrecordTagName =
array(
241 0 =>
'EnvelopeRecordVersion',
245 30 =>
'ServiceIdentifier',
246 40 =>
'EnvelopeNumber',
248 60 =>
'EnvelopePriority',
251 90 =>
'CodedCharacterSet',
252 100 =>
'UniqueObjectName',
253 120 =>
'ARMIdentifier',
257 0 =>
'ApplicationRecordVersion',
258 3 =>
'ObjectTypeReference',
259 4 =>
'ObjectAttributeReference',
262 8 =>
'EditorialUpdate',
264 12 =>
'SubjectReference',
266 20 =>
'SupplementalCategories',
267 22 =>
'FixtureIdentifier',
269 26 =>
'ContentLocationCode',
270 27 =>
'ContentLocationName',
273 37 =>
'ExpirationDate',
274 38 =>
'ExpirationTime',
275 40 =>
'SpecialInstructions',
276 42 =>
'ActionAdvised',
277 45 =>
'ReferenceService',
278 47 =>
'ReferenceDate',
279 50 =>
'ReferenceNumber',
282 62 =>
'DigitalCreationDate',
283 63 =>
'DigitalCreationTime',
284 65 =>
'OriginatingProgram',
285 70 =>
'ProgramVersion',
288 85 =>
'By-lineTitle',
290 92 =>
'Sub-location',
291 95 =>
'Province-State',
292 100 =>
'Country-PrimaryLocationCode',
293 101 =>
'Country-PrimaryLocationName',
294 103 =>
'OriginalTransmissionReference',
298 116 =>
'CopyrightNotice',
300 120 =>
'Caption-Abstract',
301 121 =>
'LocalCaption',
302 122 =>
'Writer-Editor',
303 125 =>
'RasterizedCaption',
305 131 =>
'ImageOrientation',
306 135 =>
'LanguageIdentifier',
308 151 =>
'AudioSamplingRate',
309 152 =>
'AudioSamplingResolution',
310 153 =>
'AudioDuration',
311 154 =>
'AudioOutcue',
313 185 =>
'MasterDocumentID',
314 186 =>
'ShortDocumentID',
315 187 =>
'UniqueDocumentID',
317 200 =>
'ObjectPreviewFileFormat',
318 201 =>
'ObjectPreviewFileVersion',
319 202 =>
'ObjectPreviewData',
321 225 =>
'ClassifyState',
322 228 =>
'SimilarityIndex',
323 230 =>
'DocumentNotes',
324 231 =>
'DocumentHistory',
325 232 =>
'ExifCameraInfo',
328 0 =>
'NewsPhotoVersion',
329 10 =>
'IPTCPictureNumber',
330 20 =>
'IPTCImageWidth',
331 30 =>
'IPTCImageHeight',
332 40 =>
'IPTCPixelWidth',
333 50 =>
'IPTCPixelHeight',
334 55 =>
'SupplementalType',
335 60 =>
'ColorRepresentation',
336 64 =>
'InterchangeColorSpace',
337 65 =>
'ColorSequence',
339 70 =>
'ColorCalibrationMatrix',
341 84 =>
'NumIndexEntries',
342 85 =>
'ColorPalette',
343 86 =>
'IPTCBitsPerSample',
344 90 =>
'SampleStructure',
345 100 =>
'ScanningDirection',
346 102 =>
'IPTCImageRotation',
347 110 =>
'DataCompressionMethod',
348 120 =>
'QuantizationMethod',
350 130 =>
'ExcursionTolerance',
351 135 =>
'BitsPerComponent',
352 140 =>
'MaximumDensityRange',
353 145 =>
'GammaCompensatedValue',
357 20 =>
'MaxSubfileSize',
358 90 =>
'ObjectSizeAnnounced',
359 95 =>
'MaximumObjectSize',
365 10 =>
'ConfirmedObjectSize',
371 return (isset($IPTCrecordTagName[$iptc_record][$iptc_tagkey]) ? $IPTCrecordTagName[$iptc_record][$iptc_tagkey] : $iptc_tagkey);
static GetDataImageSize($imgData, &$imageinfo)
string $tempdir
IPTCrecordTagName($iptc_record, $iptc_tagkey)
array $IPTCrecordTagName
GetId3() by James Heinrich info@getid3.org //.
IPTCrecordName($iptc_record)
array $IPTCrecordName
GetId3() by James Heinrich info@getid3.org //.
fseek($bytes, $whence=SEEK_SET)
CastAsAppropriate($value)
static CastAsInt($floatnum)
Create styles array
The data for the language used.
static DecimalizeFraction($fraction)
GetId3() by James Heinrich info@getid3.org //.