Subversion Repositories eFlore/Applications.cel

Rev

Rev 994 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 994 Rev 1155
1
<?php
1
<?php
2
/**
2
/**
3
 * Classe d'extraction de metadonnées afin de les mettre dans 
3
 * Classe d'extraction de metadonnées afin de les mettre dans
4
 * un tableau au format du cel
4
 * un tableau au format du cel
5
 * Encodage en entrée : utf8
5
 * Encodage en entrée : utf8
6
 * Encodage en sortie : utf8
6
 * Encodage en sortie : utf8
7
 *
7
 *
8
 * @author Aurélien PERONNET <aurelien@tela-botanica.org>
8
 * @author Aurélien PERONNET <aurelien@tela-botanica.org>
-
 
9
 * @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
10
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
10
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
11
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
11
 * @version $Id$
12
 * @version $Id$
-
 
13
 * @copyright © 2012, Tela Botanica
12
 */
14
 */
13
class ExtracteurMetadonnees {
15
class ExtracteurMetadonnees {
14
 
-
 
15
	 public function extraireMetadonnees($chemin_fichier)
-
 
16
	 {	
-
 
17
	 	$metadonnees = $this->decoderMetaDonnees($chemin_fichier); 	
-
 
18
		return $metadonnees ;
-
 
19
	 }
-
 
20
	 
-
 
21
	private function peutUtiliserExifTool() {
-
 
22
		// TODO indiquer ceci dans un fichier de config
-
 
23
		return file_exists('/usr/bin/exiftool') && is_executable('/usr/bin/exiftool');
-
 
24
	}
-
 
25
	
-
 
26
	private function decoderMetadonnees($chemin_image) {
-
 
27
		
-
 
28
		$metadonnees = array();
-
 
29
		
-
 
30
		if($this->peutUtiliserExifTool()) {		
-
 
31
			$res = $this->decoderMetadonneesExifTool($chemin_image);			
-
 
32
		} else {
-
 
33
			$res = $this->decoderMetadonneesBasique($chemin_image);		
-
 
34
		}
-
 
35
				
-
 
36
		$metadonnees['meta_exif'] = $this->convertirExifVersXML(&$res);
-
 
37
		$metadonnees['meta_iptc'] = $this->convertirIptcVersXML(&$res);
-
 
38
		$metadonnees['meta_xmp'] = $this->convertirXmpVersXML(&$res);
-
 
39
		$metadonnees['meta_makernote'] = $this->convertirMakernoteVersXML(&$res); 
-
 
40
		
-
 
41
		$metadonnees['appareil_fabriquant'] = $this->obtenirAppareilFabricant(&$res);
-
 
42
		$metadonnees['appareil_modele'] = $this->obtenirAppareilModele(&$res);
-
 
43
		
-
 
44
		$metadonnees['hauteur'] = $this->obtenirHauteur(&$res);
-
 
45
		$metadonnees['largeur'] = $this->obtenirLargeur(&$res);
-
 
46
		
-
 
47
		$metadonnees['date_prise_de_vue'] = $this->obtenirDatePriseDeVue(&$res);
-
 
48
		
-
 
49
		return $metadonnees;
-
 
50
	}
-
 
51
	
-
 
52
	private function obtenirAppareilFabricant($infos_meta) {
-
 
53
		
-
 
54
		$fabriquant = '';
-
 
55
		
-
 
56
		if(isset($infos_meta['EXIF']['Make'])) {
-
 
57
			$fabriquant = $infos_meta['EXIF']['Make']['valeur'];
-
 
58
		}	
-
 
59
		
-
 
60
		return $fabriquant;	
-
 
61
	}
-
 
62
	
-
 
63
	private function obtenirAppareilModele($infos_meta) {
-
 
64
		
-
 
65
		$modele = '';
-
 
66
		
-
 
67
		if(isset($infos_meta['EXIF']['CameraModelName'])) {
-
 
68
			$modele = $infos_meta['EXIF']['CameraModelName']['valeur'];
-
 
69
		}	
-
 
70
		
-
 
71
		return $modele;		
-
 
72
	}
-
 
73
	
-
 
74
	private function obtenirHauteur($infos_meta) {
-
 
75
		$hauteur = '';
-
 
76
		
-
 
77
		if(isset($infos_meta['File']['ImageHeight'])) {
-
 
78
			$hauteur = $infos_meta['File']['ImageHeight']['valeur'];
-
 
79
		}	
-
 
80
		
-
 
81
		return $hauteur;		
-
 
82
	}
-
 
83
	
-
 
84
	private function obtenirLargeur($infos_meta) {
-
 
85
		$largeur = '';
-
 
86
		
-
 
87
		if(isset($infos_meta['File']['ImageWidth'])) {
-
 
88
			$largeur = $infos_meta['File']['ImageWidth']['valeur'];
-
 
89
		}	
-
 
90
		
-
 
91
		return $largeur;		
-
 
92
	}
-
 
93
	
-
 
94
	private function obtenirDatePriseDeVue($infos_meta) {
-
 
95
		
-
 
96
		$date = '';
-
 
97
		
-
 
98
		if(isset($infos_meta['EXIF']['DateTimeOriginal'])) {
-
 
99
			$date = $infos_meta['EXIF']['DateTimeOriginal']['valeur'];
-
 
100
		}	
-
 
101
		
-
 
102
		return $date;		
-
 
103
	}
-
 
104
	
-
 
105
	private function decoderMetadonneesExifTool($chemin_image) {
16
 
106
		$metadata = array();
-
 
107
		$res = exec('/usr/bin/exiftool -g -D '.$chemin_image, $metadata);	
-
 
108
		
17
	private $meta = array();
109
		$metadata_decodees = array();
-
 
110
		
18
	private $tableau_ids_tags_exif = array(
111
		$categorie = '';
-
 
112
		foreach($metadata as &$data) {
-
 
113
			if($this->estUnSeparateurCategorieExifTool($data)) {
-
 
114
				$categorie = trim(str_replace('----','',$data));
-
 
115
			} else {
-
 
116
				$data_decodee = $this->parserValeurMetadonneeExifTool($data);
-
 
117
				$cle_metadonnee = str_replace(' ', '', $data_decodee['cle']);
-
 
118
				$metadata_decodees[$categorie][$cle_metadonnee] = $data_decodee;
-
 
119
			}
-
 
120
		}
-
 
121
				
-
 
122
		return $metadata_decodees;
-
 
123
	}
-
 
124
	
-
 
125
	private function estUnSeparateurCategorieExifTool($data) {
-
 
126
		return preg_match('^---- (.)* ----^',$data);	
-
 
127
	}
-
 
128
	
-
 
129
	private function parserValeurMetadonneeExifTool($data) {
-
 
130
		$cle_valeur = explode(':',$data,2);
-
 
131
		
-
 
132
		$valeur = '';
-
 
133
		if(count($cle_valeur) == 2) {
-
 
134
			$valeur	= trim($cle_valeur[1]);
-
 
135
		}
-
 
136
		
-
 
137
		$id_cle = explode(' ',trim($cle_valeur[0]),2);
-
 
138
		
-
 
139
		$id_cle[1] = str_replace(array('-','/'),'',$id_cle[1]);
-
 
140
				
-
 
141
		$cle_id_valeur = array('cle' => $id_cle[1], 'id' => str_replace('-','',$id_cle[0]), 'valeur' => $valeur);
-
 
142
		return $cle_id_valeur;		
-
 
143
	}
-
 
144
	
-
 
145
	private function convertirExifVersXML($donnees_meta) {
-
 
146
 
-
 
147
		$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
-
 
148
		$xml .= '<exif>';
-
 
149
		if (isset($donnees_meta['EXIF'])) {
-
 
150
			foreach ($donnees_meta['EXIF'] as $prop => &$valeur) {
-
 
151
				$xml .= '<'.$prop.' id="'.$valeur['id'].'">'.$valeur['valeur'].'</'.$prop.'>'."\n";
-
 
152
			}
-
 
153
		}
-
 
154
		$xml .= '</exif>'."\n"."\n";
-
 
155
		
-
 
156
		return $xml;
-
 
157
	}
-
 
158
	
-
 
159
	private function convertirIptcVersXML($donnees_meta) {
-
 
160
		
-
 
161
		$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
-
 
162
		$xml .= '<iptc>';
-
 
163
		if (isset($donnees_meta['IPTC'])) {
-
 
164
			foreach ($donnees_meta['IPTC'] as $prop => &$valeur) {
-
 
165
				$xml .= '<'.$prop.' id="'.$valeur['id'].'">'.$valeur['valeur'].'</'.$prop.'>'."\n";
-
 
166
			}
-
 
167
		}
-
 
168
		$xml .= '</iptc>'."\n"."\n";
-
 
169
		
-
 
170
		return $xml;
-
 
171
	}
-
 
172
	
-
 
173
	private function convertirXmpVersXML($donnees_meta) {
-
 
174
		
-
 
175
		$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
-
 
176
		$xml .= '<xmp>';
-
 
177
		if (isset($donnees_meta['XMP'])) {
-
 
178
			foreach ($donnees_meta['XMP'] as $prop => &$valeur) {
-
 
179
				$xml .= '<'.$prop.' id="'.$valeur['id'].'">'.$valeur['valeur'].'</'.$prop.'>'."\n";
-
 
180
			}
-
 
181
		}
-
 
182
		$xml .= '</xmp>';
-
 
183
		
-
 
184
		return $xml;
-
 
185
	}
-
 
186
	
-
 
187
	private function convertirMakernoteVersXML($donnees_meta) {
-
 
188
		
-
 
189
		$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
-
 
190
		$xml .= '<makernote>';
-
 
191
		if (isset($donnees_meta['MAKERNOTE'])) {
-
 
192
			foreach ($donnees_meta['MAKERNOTE'] as $prop => &$valeur) {
-
 
193
				$xml .= '<'.$prop.' id="'.$valeur['id'].'">'.$valeur['valeur'].'</'.$prop.'>'."\n";
-
 
194
			}
-
 
195
		}
-
 
196
		$xml .= '</makernote>';
-
 
197
		
-
 
198
		return '';
-
 
199
	}     
-
 
200
 
-
 
201
    public function decoderMetadonneesBasique($chemin_fichier)
-
 
202
    {   
-
 
203
    	$metadonnees = array();
-
 
204
        $exif = @exif_read_data($chemin_fichier,"EXIF,COMPUTED,IFD0,FILE,COMMENT",true,false);
-
 
205
        
-
 
206
        // tant pis pour les makernote et xmp, les décoder demande trop de librairies externes, autant installer exiftool alors
-
 
207
		$metadonnees['XMP'] = array();
-
 
208
		unset($metadonnees['EXIF']['MakerNote']);
-
 
209
		$metadonnees['MAKERNOTE'] = array();
-
 
210
        
-
 
211
		$metadonnees_non_formatees = array_merge($exif['EXIF'],$exif['IFD0']);
-
 
212
		$metadonnees['EXIF'] = $this->formaterTableauExif(&$metadonnees_non_formatees);
-
 
213
        $metadonnees['IPTC'] = $this->extraireIptc($chemin_fichier);
-
 
214
        $metadonnees['File'] = array('ImageWidth' => array('id' => '', 'valeur' => $exif['COMPUTED']['Width']), 
-
 
215
									 'ImageHeight' => array('id' => '', 'valeur' => $exif['COMPUTED']['Height']));
-
 
216
        
-
 
217
        return $metadonnees ;
-
 
218
    }
-
 
219
    
-
 
220
    private function formaterTableauExif($tableau) {
-
 
221
    	
-
 
222
    	$tableau_exif_formate = array();
-
 
223
    	
-
 
224
    	foreach($tableau as $nom_tag => $valeur) {
-
 
225
    		
-
 
226
    		$id = '';
-
 
227
    		if(isset($this->tableau_ids_tags_exif[$nom_tag])) {
-
 
228
    			$id = $this->tableau_ids_tags_exif[$nom_tag];
-
 
229
    		}
-
 
230
    		
-
 
231
    		$tableau_exif_formate[$nom_tag] = array('id' => $id, 'valeur' => $valeur);
-
 
232
    	}
-
 
233
    	
-
 
234
    	return $tableau_exif_formate;
-
 
235
    }
-
 
236
   
-
 
237
    /**
-
 
238
    * Extraction des metadonnées iptc
-
 
239
    **/
-
 
240
    public function extraireIptc($chemin_fichier)
-
 
241
    {
-
 
242
    	$meta = array();
-
 
243
    	
-
 
244
        // getimagesize renvoie les infos iptc dans le tableau info
-
 
245
        $info = array();
-
 
246
        $size = getimagesize($chemin_fichier, $info);
-
 
247
        
-
 
248
        // s'il existe
-
 
249
        if (isset($info["APP13"]))
-
 
250
        {
-
 
251
            // on parse les donnees
-
 
252
            $iptc = iptcparse($info["APP13"]);
-
 
253
            if ($iptc) {
-
 
254
                // et on les analyse
-
 
255
                foreach ($iptc as $marker => $section)
-
 
256
                {
-
 
257
                    foreach ($section as $nom => $val)
-
 
258
                    {
-
 
259
                        // pour remplir le tableau de donnees
-
 
260
                        $this->decoderValeurIptc($marker, $val ,&$meta) ;
-
 
261
                    }
-
 
262
                }
-
 
263
            }
-
 
264
        }
-
 
265
       
-
 
266
        return $meta ;
-
 
267
    }
-
 
268
   
-
 
269
    /**
-
 
270
    * Stocke une valeur de metadonnées iptc dans le champ du tableau correspondant
-
 
271
    * @param String $nom nom de la valeur
-
 
272
    * @param String $val valeur
-
 
273
    * @param String $data référence vers le tableau où la donnée sera stockée
-
 
274
    **/
-
 
275
    private function decoderValeurIptc($nom, $val ,$data_tab)
-
 
276
    {  
-
 
277
        switch($nom)
-
 
278
        {
-
 
279
            // mots cles iptc
-
 
280
            case "2#005" :
-
 
281
                $data_tab['Category'] = array('id' => '5', 'valeur' => $val);
-
 
282
            break;
-
 
283
           
-
 
284
            // champ by line
-
 
285
            case "2#080" :
-
 
286
                $data_tab['By-Line']  = array('id' => '80', 'valeur' => $val);
-
 
287
            break ;
-
 
288
           
-
 
289
            // champ by line titre
-
 
290
            case "2#085" :
-
 
291
                $data_tab['By-LineTitle'] = array('id' => '85', 'valeur' => $val);
-
 
292
            break ;
-
 
293
           
-
 
294
            // ville
-
 
295
            case "2#090" :
-
 
296
                $data_tab['City'] = array('id' => '90', 'valeur' => $val);
-
 
297
            break ;
-
 
298
           
-
 
299
            // sous location
-
 
300
            case "2#092" :
-
 
301
                $data_tab['SubLocation'] = array('id' => '92', 'valeur' => $val);
-
 
302
            break ;
-
 
303
           
-
 
304
            // etat (pour les us)
-
 
305
            case "2#095" :
-
 
306
                $data_tab['ProvinceState'] = array('id' => '95', 'valeur' => $val);
-
 
307
            break ;
-
 
308
           
-
 
309
            // code pays
-
 
310
            case "2#100" :
-
 
311
                $data_tab['CountryPrimaryLocationCode'] = array('id' => '100', 'valeur' => $val);
-
 
312
            break ;
-
 
313
           
-
 
314
            // code pays
-
 
315
            case "2#101" :
-
 
316
                $data_tab['CountryName'] = array('id' => '101', 'valeur' => $val);
-
 
317
            break ;
-
 
318
           
-
 
319
            // titre principal
-
 
320
            case "2#105" :
-
 
321
                $data_tab['Headline'] = array('id' => '105', 'valeur' => $val);
-
 
322
            break ;
-
 
323
           
-
 
324
            // credit
-
 
325
            case "2#110" :
-
 
326
                $data_tab['Credit'] = array('id' => '110', 'valeur' => $val);
-
 
327
            break ;
-
 
328
           
-
 
329
            // copyright
-
 
330
            case "2#116" :
-
 
331
                $data_tab['CopyrightNotice'] = array('id' => '116', 'valeur' => $val);
-
 
332
            break ;
-
 
333
           
-
 
334
            // contact
-
 
335
            case "2#118" :
-
 
336
                $data_tab['Contact'] = array('id' => '118', 'valeur' => $val);
-
 
337
            break ;
-
 
338
            
-
 
339
            default:
-
 
340
            	unset($data_tab['nom']);
-
 
341
            break;
-
 
342
        }
-
 
343
    }
-
 
344
    
-
 
345
	private $tableau_ids_tags_exif = array('InteropIndex' => '1',
19
			'InteropIndex' => '1',
346
		'InteropVersion' => '2',
20
			'InteropVersion' => '2',
347
		'ProcessingSoftware' => '11',
21
			'ProcessingSoftware' => '11',
348
		'SubfileType' => '254',
22
			'SubfileType' => '254',
349
		'OldSubfileType' => '255',
23
			'OldSubfileType' => '255',
350
		'ImageWidth' => '256',
24
			'ImageWidth' => '256',
351
		'ImageHeight' => '257',
25
			'ImageHeight' => '257',
352
		'BitsPerSample' => '258',
26
			'BitsPerSample' => '258',
353
		'Compression' => '259',
27
			'Compression' => '259',
354
		'PhotometricInterpretation' => '262',
28
			'PhotometricInterpretation' => '262',
355
		'Thresholding' => '263',
29
			'Thresholding' => '263',
356
		'CellWidth' => '264',
30
			'CellWidth' => '264',
357
		'CellLength' => '265',
31
			'CellLength' => '265',
358
		'FillOrder' => '266',
32
			'FillOrder' => '266',
359
		'DocumentName' => '269',
33
			'DocumentName' => '269',
360
		'ImageDescription' => '270',
34
			'ImageDescription' => '270',
361
		'Make' => '271',
35
			'Make' => '271',
362
		'Model' => '272',
36
			'Model' => '272',
363
		'StripOffsets' => '273',
37
			'StripOffsets' => '273',
364
		'Orientation' => '274',
38
			'Orientation' => '274',
365
		'SamplesPerPixel' => '277',
39
			'SamplesPerPixel' => '277',
366
		'RowsPerStrip' => '278',
40
			'RowsPerStrip' => '278',
367
		'StripByteCounts' => '279',
41
			'StripByteCounts' => '279',
368
		'MinSampleValue' => '280',
42
			'MinSampleValue' => '280',
369
		'MaxSampleValue' => '281',
43
			'MaxSampleValue' => '281',
370
		'XResolution' => '282',
44
			'XResolution' => '282',
371
		'YResolution' => '283',
45
			'YResolution' => '283',
372
		'PlanarConfiguration' => '284',
46
			'PlanarConfiguration' => '284',
373
		'PageName' => '285',
47
			'PageName' => '285',
374
		'XPosition' => '286',
48
			'XPosition' => '286',
375
		'YPosition' => '287',
49
			'YPosition' => '287',
376
		'FreeOffsets' => '288',
50
			'FreeOffsets' => '288',
377
		'FreeByteCounts' => '289',
51
			'FreeByteCounts' => '289',
378
		'GrayResponseUnit' => '290',
52
			'GrayResponseUnit' => '290',
379
		'GrayResponseCurve' => '291',
53
			'GrayResponseCurve' => '291',
380
		'T4Options' => '292',
54
			'T4Options' => '292',
381
		'T6Options' => '293',
55
			'T6Options' => '293',
382
		'ResolutionUnit' => '296',
56
			'ResolutionUnit' => '296',
383
		'PageNumber' => '297',
57
			'PageNumber' => '297',
384
		'ColorResponseUnit' => '300',
58
			'ColorResponseUnit' => '300',
385
		'TransferFunction' => '301',
59
			'TransferFunction' => '301',
386
		'Software' => '305',
60
			'Software' => '305',
387
		'ModifyDate' => '306',
61
			'ModifyDate' => '306',
388
		'Artist' => '315',
62
			'Artist' => '315',
389
		'HostComputer' => '316',
63
			'HostComputer' => '316',
390
		'Predictor' => '317',
64
			'Predictor' => '317',
391
		'WhitePoint' => '318',
65
			'WhitePoint' => '318',
392
		'PrimaryChromaticities' => '319',
66
			'PrimaryChromaticities' => '319',
393
		'ColorMap' => '320',
67
			'ColorMap' => '320',
394
		'HalftoneHints' => '321',
68
			'HalftoneHints' => '321',
395
		'TileWidth' => '322',
69
			'TileWidth' => '322',
396
		'TileLength' => '323',
70
			'TileLength' => '323',
397
		'TileOffsets' => '324',
71
			'TileOffsets' => '324',
398
		'TileByteCounts' => '325',
72
			'TileByteCounts' => '325',
399
		'BadFaxLines' => '326',
73
			'BadFaxLines' => '326',
400
		'CleanFaxData' => '327',
74
			'CleanFaxData' => '327',
401
		'ConsecutiveBadFaxLines' => '328',
75
			'ConsecutiveBadFaxLines' => '328',
402
		'SubIFD' => '330',
76
			'SubIFD' => '330',
403
		'InkSet' => '332',
77
			'InkSet' => '332',
404
		'InkNames' => '333',
78
			'InkNames' => '333',
405
		'NumberofInks' => '334',
79
			'NumberofInks' => '334',
406
		'DotRange' => '336',
80
			'DotRange' => '336',
407
		'TargetPrinter' => '337',
81
			'TargetPrinter' => '337',
408
		'ExtraSamples' => '338',
82
			'ExtraSamples' => '338',
409
		'SampleFormat' => '339',
83
			'SampleFormat' => '339',
410
		'SMinSampleValue' => '340',
84
			'SMinSampleValue' => '340',
411
		'SMaxSampleValue' => '341',
85
			'SMaxSampleValue' => '341',
412
		'TransferRange' => '342',
86
			'TransferRange' => '342',
413
		'ClipPath' => '343',
87
			'ClipPath' => '343',
414
		'XClipPathUnits' => '344',
88
			'XClipPathUnits' => '344',
415
		'YClipPathUnits' => '345',
89
			'YClipPathUnits' => '345',
416
		'Indexed' => '346',
90
			'Indexed' => '346',
417
		'JPEGTables' => '347',
91
			'JPEGTables' => '347',
418
		'OPIProxy' => '351',
92
			'OPIProxy' => '351',
419
		'GlobalParametersIFD' => '400',
93
			'GlobalParametersIFD' => '400',
420
		'ProfileType' => '401',
94
			'ProfileType' => '401',
421
		'FaxProfile' => '402',
95
			'FaxProfile' => '402',
422
		'CodingMethods' => '403',
96
			'CodingMethods' => '403',
423
		'VersionYear' => '404',
97
			'VersionYear' => '404',
424
		'ModeNumber' => '405',
98
			'ModeNumber' => '405',
425
		'Decode' => '433',
99
			'Decode' => '433',
426
		'DefaultImageColor' => '434',
100
			'DefaultImageColor' => '434',
427
		'T82Options' => '435',
101
			'T82Options' => '435',
428
		'JPEGTables' => '437',
102
			'JPEGTables' => '437',
429
		'JPEGProc' => '512',
103
			'JPEGProc' => '512',
430
		'ThumbnailOffset' => '513',
104
			'ThumbnailOffset' => '513',
431
		'ThumbnailLength' => '514',
105
			'ThumbnailLength' => '514',
432
		'JPEGRestartInterval' => '515',
106
			'JPEGRestartInterval' => '515',
433
		'JPEGLosslessPredictors' => '517',
107
			'JPEGLosslessPredictors' => '517',
434
		'JPEGPointTransforms' => '518',
108
			'JPEGPointTransforms' => '518',
435
		'JPEGQTables' => '519',
109
			'JPEGQTables' => '519',
436
		'JPEGDCTables' => '520',
110
			'JPEGDCTables' => '520',
437
		'JPEGACTables' => '521',
111
			'JPEGACTables' => '521',
438
		'YCbCrCoefficients' => '529',
112
			'YCbCrCoefficients' => '529',
439
		'YCbCrSubSampling' => '530',
113
			'YCbCrSubSampling' => '530',
440
		'YCbCrPositioning' => '531',
114
			'YCbCrPositioning' => '531',
441
		'ReferenceBlackWhite' => '532',
115
			'ReferenceBlackWhite' => '532',
442
		'StripRowCounts' => '559',
116
			'StripRowCounts' => '559',
443
		'ApplicationNotes' => '700',
117
			'ApplicationNotes' => '700',
444
		'USPTOMiscellaneous' => '999',
118
			'USPTOMiscellaneous' => '999',
445
		'RelatedImageFileFormat' => '4096',
119
			'RelatedImageFileFormat' => '4096',
446
		'RelatedImageWidth' => '4097',
120
			'RelatedImageWidth' => '4097',
447
		'RelatedImageHeight' => '4098',
121
			'RelatedImageHeight' => '4098',
448
		'Rating' => '18246',
122
			'Rating' => '18246',
449
		'XP_DIP_XML' => '18247',
123
			'XP_DIP_XML' => '18247',
450
		'StitchInfo' => '18248',
124
			'StitchInfo' => '18248',
451
		'RatingPercent' => '18249',
125
			'RatingPercent' => '18249',
452
		'ImageID' => '32781',
126
			'ImageID' => '32781',
453
		'WangTag1' => '32931',
127
			'WangTag1' => '32931',
454
		'WangAnnotation' => '32932',
128
			'WangAnnotation' => '32932',
455
		'WangTag3' => '32933',
129
			'WangTag3' => '32933',
456
		'WangTag4' => '32934',
130
			'WangTag4' => '32934',
457
		'Matteing' => '32995',
131
			'Matteing' => '32995',
458
		'DataType' => '32996',
132
			'DataType' => '32996',
459
		'ImageDepth' => '32997',
133
			'ImageDepth' => '32997',
460
		'TileDepth' => '32998',
134
			'TileDepth' => '32998',
461
		'Model2' => '33405',
135
			'Model2' => '33405',
462
		'CFARepeatPatternDim' => '33421',
136
			'CFARepeatPatternDim' => '33421',
463
		'CFAPattern2' => '33422',
137
			'CFAPattern2' => '33422',
464
		'BatteryLevel' => '33423',
138
			'BatteryLevel' => '33423',
465
		'KodakIFD' => '33424',
139
			'KodakIFD' => '33424',
466
		'Copyright' => '33432',
140
			'Copyright' => '33432',
467
		'ExposureTime' => '33434',
141
			'ExposureTime' => '33434',
468
		'FNumber' => '33437',
142
			'FNumber' => '33437',
469
		'MDFileTag' => '33445',
143
			'MDFileTag' => '33445',
470
		'MDScalePixel' => '33446',
144
			'MDScalePixel' => '33446',
471
		'MDColorTable' => '33447',
145
			'MDColorTable' => '33447',
472
		'MDLabName' => '33448',
146
			'MDLabName' => '33448',
473
		'MDSampleInfo' => '33449',
147
			'MDSampleInfo' => '33449',
474
		'MDPrepDate' => '33450',
148
			'MDPrepDate' => '33450',
475
		'MDPrepTime' => '33451',
149
			'MDPrepTime' => '33451',
476
		'MDFileUnits' => '33452',
150
			'MDFileUnits' => '33452',
477
		'PixelScale' => '33550',
151
			'PixelScale' => '33550',
478
		'AdventScale' => '33589',
152
			'AdventScale' => '33589',
479
		'AdventRevision' => '33590',
153
			'AdventRevision' => '33590',
480
		'UIC1Tag' => '33628',
154
			'UIC1Tag' => '33628',
481
		'UIC2Tag' => '33629',
155
			'UIC2Tag' => '33629',
482
		'UIC3Tag' => '33630',
156
			'UIC3Tag' => '33630',
483
		'UIC4Tag' => '33631',
157
			'UIC4Tag' => '33631',
484
		'IPTC-NAA' => '33723',
158
			'IPTC-NAA' => '33723',
485
		'IntergraphPacketData' => '33918',
159
			'IntergraphPacketData' => '33918',
486
		'IntergraphFlagRegisters' => '33919',
160
			'IntergraphFlagRegisters' => '33919',
487
		'IntergraphMatrix' => '33920',
161
			'IntergraphMatrix' => '33920',
488
		'INGRReserved' => '33921',
162
			'INGRReserved' => '33921',
489
		'ModelTiePoint' => '33922',
163
			'ModelTiePoint' => '33922',
490
		'Site' => '34016',
164
			'Site' => '34016',
491
		'ColorSequence' => '34017',
165
			'ColorSequence' => '34017',
492
		'IT8Header' => '34018',
166
			'IT8Header' => '34018',
493
		'RasterPadding' => '34019',
167
			'RasterPadding' => '34019',
494
		'BitsPerRunLength' => '34020',
168
			'BitsPerRunLength' => '34020',
495
		'BitsPerExtendedRunLength' => '34021',
169
			'BitsPerExtendedRunLength' => '34021',
496
		'ColorTable' => '34022',
170
			'ColorTable' => '34022',
497
		'ImageColorIndicator' => '34023',
171
			'ImageColorIndicator' => '34023',
498
		'BackgroundColorIndicator' => '34024',
172
			'BackgroundColorIndicator' => '34024',
499
		'ImageColorValue' => '34025',
173
			'ImageColorValue' => '34025',
500
		'BackgroundColorValue' => '34026',
174
			'BackgroundColorValue' => '34026',
501
		'PixelIntensityRange' => '34027',
175
			'PixelIntensityRange' => '34027',
502
		'TransparencyIndicator' => '34028',
176
			'TransparencyIndicator' => '34028',
503
		'ColorCharacterization' => '34029',
177
			'ColorCharacterization' => '34029',
504
		'HCUsage' => '34030',
178
			'HCUsage' => '34030',
505
		'TrapIndicator' => '34031',
179
			'TrapIndicator' => '34031',
506
		'CMYKEquivalent' => '34032',
180
			'CMYKEquivalent' => '34032',
507
		'SEMInfo' => '34118',
181
			'SEMInfo' => '34118',
508
		'AFCP_IPTC' => '34152',
182
			'AFCP_IPTC' => '34152',
509
		'PixelMagicJBIGOptions' => '34232',
183
			'PixelMagicJBIGOptions' => '34232',
510
		'ModelTransform' => '34264',
184
			'ModelTransform' => '34264',
511
		'WB_GRGBLevels' => '34306',
185
			'WB_GRGBLevels' => '34306',
512
		'LeafData' => '34310',
186
			'LeafData' => '34310',
513
		'PhotoshopSettings' => '34377',
187
			'PhotoshopSettings' => '34377',
514
		'ExifOffset' => '34665',
188
			'ExifOffset' => '34665',
515
		'ICC_Profile' => '34675',
189
			'ICC_Profile' => '34675',
516
		'TIFF_FXExtensions' => '34687',
190
			'TIFF_FXExtensions' => '34687',
517
		'MultiProfiles' => '34688',
191
			'MultiProfiles' => '34688',
518
		'SharedData' => '34689',
192
			'SharedData' => '34689',
519
		'T88Options' => '34690',
193
			'T88Options' => '34690',
520
		'ImageLayer' => '34732',
194
			'ImageLayer' => '34732',
521
		'GeoTiffDirectory' => '34735',
195
			'GeoTiffDirectory' => '34735',
522
		'GeoTiffDoubleParams' => '34736',
196
			'GeoTiffDoubleParams' => '34736',
523
		'GeoTiffAsciiParams' => '34737',
197
			'GeoTiffAsciiParams' => '34737',
524
		'ExposureProgram' => '34850',
198
			'ExposureProgram' => '34850',
525
		'SpectralSensitivity' => '34852',
199
			'SpectralSensitivity' => '34852',
526
		'GPSInfo' => '34853',
200
			'GPSInfo' => '34853',
527
		'ISO' => '34855',
201
			'ISO' => '34855',
528
		'Opto-ElectricConvFactor' => '34856',
202
			'Opto-ElectricConvFactor' => '34856',
529
		'Interlace' => '34857',
203
			'Interlace' => '34857',
530
		'TimeZoneOffset' => '34858',
204
			'TimeZoneOffset' => '34858',
531
		'SelfTimerMode' => '34859',
205
			'SelfTimerMode' => '34859',
532
		'SensitivityType' => '34864',
206
			'SensitivityType' => '34864',
533
		'StandardOutputSensitivity' => '34865',
207
			'StandardOutputSensitivity' => '34865',
534
		'RecommendedExposureIndex' => '34866',
208
			'RecommendedExposureIndex' => '34866',
535
		'ISOSpeed' => '34867',
209
			'ISOSpeed' => '34867',
536
		'ISOSpeedLatitudeyyy' => '34868',
210
			'ISOSpeedLatitudeyyy' => '34868',
537
		'ISOSpeedLatitudezzz' => '34869',
211
			'ISOSpeedLatitudezzz' => '34869',
538
		'FaxRecvParams' => '34908',
212
			'FaxRecvParams' => '34908',
539
		'FaxSubAddress' => '34909',
213
			'FaxSubAddress' => '34909',
540
		'FaxRecvTime' => '34910',
214
			'FaxRecvTime' => '34910',
541
		'LeafSubIFD' => '34954',
215
			'LeafSubIFD' => '34954',
542
		'ExifVersion' => '36864',
216
			'ExifVersion' => '36864',
543
		'DateTimeOriginal' => '36867',
217
			'DateTimeOriginal' => '36867',
544
		'CreateDate' => '36868',
218
			'CreateDate' => '36868',
545
		'ComponentsConfiguration' => '37121',
219
			'ComponentsConfiguration' => '37121',
546
		'CompressedBitsPerPixel' => '37122',
220
			'CompressedBitsPerPixel' => '37122',
547
		'ShutterSpeedValue' => '37377',
221
			'ShutterSpeedValue' => '37377',
548
		'ApertureValue' => '37378',
222
			'ApertureValue' => '37378',
549
		'BrightnessValue' => '37379',
223
			'BrightnessValue' => '37379',
550
		'ExposureCompensation' => '37380',
224
			'ExposureCompensation' => '37380',
551
		'MaxApertureValue' => '37381',
225
			'MaxApertureValue' => '37381',
552
		'SubjectDistance' => '37382',
226
			'SubjectDistance' => '37382',
553
		'MeteringMode' => '37383',
227
			'MeteringMode' => '37383',
554
		'LightSource' => '37384',
228
			'LightSource' => '37384',
555
		'Flash' => '37385',
229
			'Flash' => '37385',
556
		'FocalLength' => '37386',
230
			'FocalLength' => '37386',
557
		'FlashEnergy' => '37387',
231
			'FlashEnergy' => '37387',
558
		'SpatialFrequencyResponse' => '37388',
232
			'SpatialFrequencyResponse' => '37388',
559
		'Noise' => '37389',
233
			'Noise' => '37389',
560
		'FocalPlaneXResolution' => '37390',
234
			'FocalPlaneXResolution' => '37390',
561
		'FocalPlaneYResolution' => '37391',
235
			'FocalPlaneYResolution' => '37391',
562
		'FocalPlaneResolutionUnit' => '37392',
236
			'FocalPlaneResolutionUnit' => '37392',
563
		'ImageNumber' => '37393',
237
			'ImageNumber' => '37393',
564
		'SecurityClassification' => '37394',
238
			'SecurityClassification' => '37394',
565
		'ImageHistory' => '37395',
239
			'ImageHistory' => '37395',
566
		'SubjectArea' => '37396',
240
			'SubjectArea' => '37396',
567
		'ExposureIndex' => '37397',
241
			'ExposureIndex' => '37397',
568
		'TIFF-EPStandardID' => '37398',
242
			'TIFF-EPStandardID' => '37398',
569
		'SensingMethod' => '37399',
243
			'SensingMethod' => '37399',
570
		'CIP3DataFile' => '37434',
244
			'CIP3DataFile' => '37434',
571
		'CIP3Sheet' => '37435',
245
			'CIP3Sheet' => '37435',
572
		'CIP3Side' => '37436',
246
			'CIP3Side' => '37436',
573
		'StoNits' => '37439',
247
			'StoNits' => '37439',
574
		'MakerNoteCanon' => '37500',
248
			'MakerNoteCanon' => '37500',
575
		'UserComment' => '37510',
249
			'UserComment' => '37510',
576
		'SubSecTime' => '37520',
250
			'SubSecTime' => '37520',
577
		'SubSecTimeOriginal' => '37521',
251
			'SubSecTimeOriginal' => '37521',
578
		'SubSecTimeDigitized' => '37522',
252
			'SubSecTimeDigitized' => '37522',
579
		'MSDocumentText' => '37679',
253
			'MSDocumentText' => '37679',
580
		'MSPropertySetStorage' => '37680',
254
			'MSPropertySetStorage' => '37680',
581
		'MSDocumentTextPosition' => '37681',
255
			'MSDocumentTextPosition' => '37681',
582
		'ImageSourceData' => '37724',
256
			'ImageSourceData' => '37724',
583
		'XPTitle' => '40091',
257
			'XPTitle' => '40091',
584
		'XPComment' => '40092',
258
			'XPComment' => '40092',
585
		'XPAuthor' => '40093',
259
			'XPAuthor' => '40093',
586
		'XPKeywords' => '40094',
260
			'XPKeywords' => '40094',
587
		'XPSubject' => '40095',
261
			'XPSubject' => '40095',
588
		'FlashpixVersion' => '40960',
262
			'FlashpixVersion' => '40960',
589
		'ColorSpace' => '40961',
263
			'ColorSpace' => '40961',
590
		'ExifImageWidth' => '40962',
264
			'ExifImageWidth' => '40962',
591
		'ExifImageHeight' => '40963',
265
			'ExifImageHeight' => '40963',
592
		'RelatedSoundFile' => '40964',
266
			'RelatedSoundFile' => '40964',
593
		'InteropOffset' => '40965',
267
			'InteropOffset' => '40965',
594
		'FlashEnergy' => '41483',
268
			'FlashEnergy' => '41483',
595
		'SpatialFrequencyResponse' => '41484',
269
			'SpatialFrequencyResponse' => '41484',
596
		'Noise' => '41485',
270
			'Noise' => '41485',
597
		'FocalPlaneXResolution' => '41486',
271
			'FocalPlaneXResolution' => '41486',
598
		'FocalPlaneYResolution' => '41487',
272
			'FocalPlaneYResolution' => '41487',
599
		'FocalPlaneResolutionUnit' => '41488',
273
			'FocalPlaneResolutionUnit' => '41488',
600
		'ImageNumber' => '41489',
274
			'ImageNumber' => '41489',
601
		'SecurityClassification' => '41490',
275
			'SecurityClassification' => '41490',
602
		'ImageHistory' => '41491',
276
			'ImageHistory' => '41491',
603
		'SubjectLocation' => '41492',
277
			'SubjectLocation' => '41492',
604
		'ExposureIndex' => '41493',
278
			'ExposureIndex' => '41493',
605
		'TIFF-EPStandardID' => '41494',
279
			'TIFF-EPStandardID' => '41494',
606
		'SensingMethod' => '41495',
280
			'SensingMethod' => '41495',
607
		'FileSource' => '41728',
281
			'FileSource' => '41728',
608
		'SceneType' => '41729',
282
			'SceneType' => '41729',
609
		'CFAPattern' => '41730',
283
			'CFAPattern' => '41730',
610
		'CustomRendered' => '41985',
284
			'CustomRendered' => '41985',
611
		'ExposureMode' => '41986',
285
			'ExposureMode' => '41986',
612
		'WhiteBalance' => '41987',
286
			'WhiteBalance' => '41987',
613
		'DigitalZoomRatio' => '41988',
287
			'DigitalZoomRatio' => '41988',
614
		'FocalLengthIn35mmFormat' => '41989',
288
			'FocalLengthIn35mmFormat' => '41989',
615
		'SceneCaptureType' => '41990',
289
			'SceneCaptureType' => '41990',
616
		'GainControl' => '41991',
290
			'GainControl' => '41991',
617
		'Contrast' => '41992',
291
			'Contrast' => '41992',
618
		'Saturation' => '41993',
292
			'Saturation' => '41993',
619
		'Sharpness' => '41994',
293
			'Sharpness' => '41994',
620
		'DeviceSettingDescription' => '41995',
294
			'DeviceSettingDescription' => '41995',
621
		'SubjectDistanceRange' => '41996',
295
			'SubjectDistanceRange' => '41996',
622
		'ImageUniqueID' => '42016',
296
			'ImageUniqueID' => '42016',
623
		'OwnerName' => '42032',
297
			'OwnerName' => '42032',
624
		'SerialNumber' => '42033',
298
			'SerialNumber' => '42033',
625
		'LensInfo' => '42034',
299
			'LensInfo' => '42034',
626
		'LensMake' => '42035',
300
			'LensMake' => '42035',
627
		'LensModel' => '42036',
301
			'LensModel' => '42036',
628
		'LensSerialNumber' => '42037',
302
			'LensSerialNumber' => '42037',
629
		'GDALMetadata' => '42112',
303
			'GDALMetadata' => '42112',
630
		'GDALNoData' => '42113',
304
			'GDALNoData' => '42113',
631
		'Gamma' => '42240',
305
			'Gamma' => '42240',
632
		'ExpandSoftware' => '44992',
306
			'ExpandSoftware' => '44992',
633
		'ExpandLens' => '44993',
307
			'ExpandLens' => '44993',
634
		'ExpandFilm' => '44994',
308
			'ExpandFilm' => '44994',
635
		'ExpandFilterLens' => '44995',
309
			'ExpandFilterLens' => '44995',
636
		'ExpandScanner' => '44996',
310
			'ExpandScanner' => '44996',
637
		'ExpandFlashLamp' => '44997',
311
			'ExpandFlashLamp' => '44997',
638
		'PixelFormat' => '48129',
312
			'PixelFormat' => '48129',
639
		'Transformation' => '48130',
313
			'Transformation' => '48130',
640
		'Uncompressed' => '48131',
314
			'Uncompressed' => '48131',
641
		'ImageType' => '48132',
315
			'ImageType' => '48132',
642
		'ImageWidth' => '48256',
316
			'ImageWidth' => '48256',
643
		'ImageHeight' => '48257',
317
			'ImageHeight' => '48257',
644
		'WidthResolution' => '48258',
318
			'WidthResolution' => '48258',
645
		'HeightResolution' => '48259',
319
			'HeightResolution' => '48259',
646
		'ImageOffset' => '48320',
320
			'ImageOffset' => '48320',
647
		'ImageByteCount' => '48321',
321
			'ImageByteCount' => '48321',
648
		'AlphaOffset' => '48322',
322
			'AlphaOffset' => '48322',
649
		'AlphaByteCount' => '48323',
323
			'AlphaByteCount' => '48323',
650
		'ImageDataDiscard' => '48324',
324
			'ImageDataDiscard' => '48324',
651
		'AlphaDataDiscard' => '48325',
325
			'AlphaDataDiscard' => '48325',
652
		'OceScanjobDesc' => '50215',
326
			'OceScanjobDesc' => '50215',
653
		'OceApplicationSelector' => '50216',
327
			'OceApplicationSelector' => '50216',
654
		'OceIDNumber' => '50217',
328
			'OceIDNumber' => '50217',
655
		'OceImageLogic' => '50218',
329
			'OceImageLogic' => '50218',
656
		'Annotations' => '50255',
330
			'Annotations' => '50255',
657
		'PrintIM' => '50341',
331
			'PrintIM' => '50341',
658
		'USPTOOriginalContentType' => '50560',
332
			'USPTOOriginalContentType' => '50560',
659
		'DNGVersion' => '50706',
333
			'DNGVersion' => '50706',
660
		'DNGBackwardVersion' => '50707',
334
			'DNGBackwardVersion' => '50707',
661
		'UniqueCameraModel' => '50708',
335
			'UniqueCameraModel' => '50708',
662
		'LocalizedCameraModel' => '50709',
336
			'LocalizedCameraModel' => '50709',
663
		'CFAPlaneColor' => '50710',
337
			'CFAPlaneColor' => '50710',
664
		'CFALayout' => '50711',
338
			'CFALayout' => '50711',
665
		'LinearizationTable' => '50712',
339
			'LinearizationTable' => '50712',
666
		'BlackLevelRepeatDim' => '50713',
340
			'BlackLevelRepeatDim' => '50713',
667
		'BlackLevel' => '50714',
341
			'BlackLevel' => '50714',
668
		'BlackLevelDeltaH' => '50715',
342
			'BlackLevelDeltaH' => '50715',
669
		'BlackLevelDeltaV' => '50716',
343
			'BlackLevelDeltaV' => '50716',
670
		'WhiteLevel' => '50717',
344
			'WhiteLevel' => '50717',
671
		'DefaultScale' => '50718',
345
			'DefaultScale' => '50718',
672
		'DefaultCropOrigin' => '50719',
346
			'DefaultCropOrigin' => '50719',
673
		'DefaultCropSize' => '50720',
347
			'DefaultCropSize' => '50720',
674
		'ColorMatrix1' => '50721',
348
			'ColorMatrix1' => '50721',
675
		'ColorMatrix2' => '50722',
349
			'ColorMatrix2' => '50722',
676
		'CameraCalibration1' => '50723',
350
			'CameraCalibration1' => '50723',
677
		'CameraCalibration2' => '50724',
351
			'CameraCalibration2' => '50724',
678
		'ReductionMatrix1' => '50725',
352
			'ReductionMatrix1' => '50725',
679
		'ReductionMatrix2' => '50726',
353
			'ReductionMatrix2' => '50726',
680
		'AnalogBalance' => '50727',
354
			'AnalogBalance' => '50727',
681
		'AsShotNeutral' => '50728',
355
			'AsShotNeutral' => '50728',
682
		'AsShotWhiteXY' => '50729',
356
			'AsShotWhiteXY' => '50729',
683
		'BaselineExposure' => '50730',
357
			'BaselineExposure' => '50730',
684
		'BaselineNoise' => '50731',
358
			'BaselineNoise' => '50731',
685
		'BaselineSharpness' => '50732',
359
			'BaselineSharpness' => '50732',
686
		'BayerGreenSplit' => '50733',
360
			'BayerGreenSplit' => '50733',
687
		'LinearResponseLimit' => '50734',
361
			'LinearResponseLimit' => '50734',
688
		'CameraSerialNumber' => '50735',
362
			'CameraSerialNumber' => '50735',
689
		'DNGLensInfo' => '50736',
363
			'DNGLensInfo' => '50736',
690
		'ChromaBlurRadius' => '50737',
364
			'ChromaBlurRadius' => '50737',
691
		'AntiAliasStrength' => '50738',
365
			'AntiAliasStrength' => '50738',
692
		'ShadowScale' => '50739',
366
			'ShadowScale' => '50739',
693
		'SR2Private' => '50740',
367
			'SR2Private' => '50740',
694
		'MakerNoteSafety' => '50741',
368
			'MakerNoteSafety' => '50741',
695
		'RawImageSegmentation' => '50752',
369
			'RawImageSegmentation' => '50752',
696
		'CalibrationIlluminant1' => '50778',
370
			'CalibrationIlluminant1' => '50778',
697
		'CalibrationIlluminant2' => '50779',
371
			'CalibrationIlluminant2' => '50779',
698
		'BestQualityScale' => '50780',
372
			'BestQualityScale' => '50780',
699
		'RawDataUniqueID' => '50781',
373
			'RawDataUniqueID' => '50781',
700
		'AliasLayerMetadata' => '50784',
374
			'AliasLayerMetadata' => '50784',
701
		'OriginalRawFileName' => '50827',
375
			'OriginalRawFileName' => '50827',
702
		'OriginalRawFileData' => '50828',
376
			'OriginalRawFileData' => '50828',
703
		'ActiveArea' => '50829',
377
			'ActiveArea' => '50829',
704
		'MaskedAreas' => '50830',
378
			'MaskedAreas' => '50830',
705
		'AsShotICCProfile' => '50831',
379
			'AsShotICCProfile' => '50831',
706
		'AsShotPreProfileMatrix' => '50832',
380
			'AsShotPreProfileMatrix' => '50832',
707
		'CurrentICCProfile' => '50833',
381
			'CurrentICCProfile' => '50833',
708
		'CurrentPreProfileMatrix' => '50834',
382
			'CurrentPreProfileMatrix' => '50834',
709
		'ColorimetricReference' => '50879',
383
			'ColorimetricReference' => '50879',
710
		'PanasonicTitle' => '50898',
384
			'PanasonicTitle' => '50898',
711
		'PanasonicTitle2' => '50899',
385
			'PanasonicTitle2' => '50899',
712
		'CameraCalibrationSig' => '50931',
386
			'CameraCalibrationSig' => '50931',
713
		'ProfileCalibrationSig' => '50932',
387
			'ProfileCalibrationSig' => '50932',
714
		'ProfileIFD' => '50933',
388
			'ProfileIFD' => '50933',
715
		'AsShotProfileName' => '50934',
389
			'AsShotProfileName' => '50934',
716
		'NoiseReductionApplied' => '50935',
390
			'NoiseReductionApplied' => '50935',
717
		'ProfileName' => '50936',
391
			'ProfileName' => '50936',
718
		'ProfileHueSatMapDims' => '50937',
392
			'ProfileHueSatMapDims' => '50937',
719
		'ProfileHueSatMapData1' => '50938',
393
			'ProfileHueSatMapData1' => '50938',
720
		'ProfileHueSatMapData2' => '50939',
394
			'ProfileHueSatMapData2' => '50939',
721
		'ProfileToneCurve' => '50940',
395
			'ProfileToneCurve' => '50940',
722
		'ProfileEmbedPolicy' => '50941',
396
			'ProfileEmbedPolicy' => '50941',
723
		'ProfileCopyright' => '50942',
397
			'ProfileCopyright' => '50942',
724
		'ForwardMatrix1' => '50964',
398
			'ForwardMatrix1' => '50964',
725
		'ForwardMatrix2' => '50965',
399
			'ForwardMatrix2' => '50965',
726
		'PreviewApplicationName' => '50966',
400
			'PreviewApplicationName' => '50966',
727
		'PreviewApplicationVersion' => '50967',
401
			'PreviewApplicationVersion' => '50967',
728
		'PreviewSettingsName' => '50968',
402
			'PreviewSettingsName' => '50968',
729
		'PreviewSettingsDigest' => '50969',
403
			'PreviewSettingsDigest' => '50969',
730
		'PreviewColorSpace' => '50970',
404
			'PreviewColorSpace' => '50970',
731
		'PreviewDateTime' => '50971',
405
			'PreviewDateTime' => '50971',
732
		'RawImageDigest' => '50972',
406
			'RawImageDigest' => '50972',
733
		'OriginalRawFileDigest' => '50973',
407
			'OriginalRawFileDigest' => '50973',
734
		'SubTileBlockSize' => '50974',
408
			'SubTileBlockSize' => '50974',
735
		'RowInterleaveFactor' => '50975',
409
			'RowInterleaveFactor' => '50975',
736
		'ProfileLookTableDims' => '50981',
410
			'ProfileLookTableDims' => '50981',
737
		'ProfileLookTableData' => '50982',
411
			'ProfileLookTableData' => '50982',
738
		'OpcodeList1' => '51008',
412
			'OpcodeList1' => '51008',
739
		'OpcodeList2' => '51009',
413
			'OpcodeList2' => '51009',
740
		'OpcodeList3' => '51022',
414
			'OpcodeList3' => '51022',
741
		'NoiseProfile' => '51041',
415
			'NoiseProfile' => '51041',
742
		'Padding' => '59932',
416
			'Padding' => '59932',
743
		'OffsetSchema' => '59933',
417
			'OffsetSchema' => '59933',
744
		'OwnerName' => '65000',
418
			'OwnerName' => '65000',
745
		'SerialNumber' => '65001',
419
			'SerialNumber' => '65001',
746
		'Lens' => '65002',
420
			'Lens' => '65002',
747
		'KDC_IFD' => '65024',
421
			'KDC_IFD' => '65024',
748
		'RawFile' => '65100',
422
			'RawFile' => '65100',
749
		'Converter' => '65101',
423
			'Converter' => '65101',
750
		'WhiteBalance' => '65102',
424
			'WhiteBalance' => '65102',
751
		'Exposure' => '65105',
425
			'Exposure' => '65105',
752
		'Shadows' => '65106',
426
			'Shadows' => '65106',
753
		'Brightness' => '65107',
427
			'Brightness' => '65107',
754
		'Contrast' => '65108',
428
			'Contrast' => '65108',
755
		'Saturation' => '65109',
429
			'Saturation' => '65109',
756
		'Sharpness' => '65110',
430
			'Sharpness' => '65110',
757
		'Smoothness' => '65111',
431
			'Smoothness' => '65111',
758
		'MoireFilter' => '65112',
432
			'MoireFilter' => '65112',
759
	);
433
	);
-
 
434
 
-
 
435
	public function extraireMetadonnees($cheminImage) {
-
 
436
		if ($this->peutUtiliserExifTool()) {
-
 
437
			$this->meta = $this->decoderMetadonneesExifTool($cheminImage);
-
 
438
		} else {
-
 
439
			$this->meta = $this->decoderMetadonneesBasique($cheminImage);
-
 
440
		}
-
 
441
 
-
 
442
		$metadonnees = array();
-
 
443
		$metadonnees['hauteur'] = $this->obtenirHauteur();
-
 
444
		$metadonnees['largeur'] = $this->obtenirLargeur();
-
 
445
		$metadonnees['date_prise_de_vue'] = $this->obtenirDatePriseDeVue();
-
 
446
		$metadonnees['appareil_fabriquant'] = $this->obtenirAppareilFabricant();
-
 
447
		$metadonnees['appareil_modele'] = $this->obtenirAppareilModele();
-
 
448
		$metadonnees['meta_exif'] = $this->convertirMetaVersXML('EXIF');
-
 
449
		$metadonnees['meta_iptc'] = $this->convertirMetaVersXML('IPTC');
-
 
450
		$metadonnees['meta_xmp'] = $this->convertirMetaVersXML('XMP');
-
 
451
		$metadonnees['meta_makernote'] = $this->convertirMetaVersXML('MAKERNOTE');
-
 
452
		return $metadonnees;
-
 
453
	}
-
 
454
 
-
 
455
	private function peutUtiliserExifTool() {
-
 
456
		// TODO indiquer ceci dans un fichier de config
-
 
457
		return file_exists('/usr/bin/exiftool') && is_executable('/usr/bin/exiftool');
-
 
458
	}
-
 
459
 
-
 
460
	private function decoderMetadonneesExifTool($cheminImage) {
-
 
461
		$metadata = array();
-
 
462
		$res = exec('/usr/bin/exiftool -g -D '.$cheminImage, $metadata);
-
 
463
 
-
 
464
		$metadata_decodees = array();
-
 
465
		$categorie = '';
-
 
466
		foreach($metadata as &$data) {
-
 
467
			if ($this->estUnSeparateurCategorieExifTool($data)) {
-
 
468
				$categorie = trim(str_replace('----', '', $data));
-
 
469
			} else {
-
 
470
				$data_decodee = $this->parserValeurMetadonneeExifTool($data);
-
 
471
				$cle_metadonnee = str_replace(' ', '', $data_decodee['cle']);
-
 
472
				$metadata_decodees[$categorie][$cle_metadonnee] = $data_decodee;
-
 
473
			}
-
 
474
		}
-
 
475
		return $metadata_decodees;
-
 
476
	}
-
 
477
 
-
 
478
	private function estUnSeparateurCategorieExifTool($data) {
-
 
479
		return preg_match('^---- (.)* ----^',$data);
-
 
480
	}
-
 
481
 
-
 
482
	private function parserValeurMetadonneeExifTool($data) {
-
 
483
		$cle_valeur = explode(':',$data,2);
-
 
484
 
-
 
485
		$valeur = '';
-
 
486
		if(count($cle_valeur) == 2) {
-
 
487
			$valeur	= trim($cle_valeur[1]);
-
 
488
		}
-
 
489
 
-
 
490
		$id_cle = explode(' ',trim($cle_valeur[0]),2);
-
 
491
 
-
 
492
		$id_cle[1] = str_replace(array('-','/'),'',$id_cle[1]);
-
 
493
 
-
 
494
		$cle_id_valeur = array('cle' => $id_cle[1], 'id' => str_replace('-','',$id_cle[0]), 'valeur' => $valeur);
-
 
495
		return $cle_id_valeur;
-
 
496
	}
-
 
497
 
-
 
498
	public function decoderMetadonneesBasique($chemin_fichier) {
-
 
499
    	$exif = @exif_read_data($chemin_fichier, "EXIF,COMPUTED,IFD0,FILE,COMMENT", true, false);
-
 
500
 
-
 
501
        // tant pis pour les makernote et xmp, les décoder demande trop de librairies externes, autant installer exiftool alors
-
 
502
        $metadonnees = array();
-
 
503
		$metadonnees['XMP'] = array();
-
 
504
		unset($metadonnees['EXIF']['MakerNote']);
-
 
505
		$metadonnees['MAKERNOTE'] = array();
-
 
506
		$metadonnees_non_formatees = array_merge($exif['EXIF'], $exif['IFD0']);
-
 
507
		$metadonnees['EXIF'] = $this->formaterTableauExif(&$metadonnees_non_formatees);
-
 
508
        $metadonnees['IPTC'] = $this->extraireIptc($chemin_fichier);
-
 
509
        $metadonnees['File'] = array(
-
 
510
        	'ImageWidth' => array('id' => '', 'valeur' => $exif['COMPUTED']['Width']),
-
 
511
			'ImageHeight' => array('id' => '', 'valeur' => $exif['COMPUTED']['Height']));
-
 
512
        return $metadonnees ;
-
 
513
    }
-
 
514
 
-
 
515
    private function formaterTableauExif($tableau) {
-
 
516
    	$tableau_exif_formate = array();
-
 
517
 
-
 
518
    	foreach ($tableau as $nom_tag => $valeur) {
-
 
519
    		$id = '';
-
 
520
    		if (isset($this->tableau_ids_tags_exif[$nom_tag])) {
-
 
521
    			$id = $this->tableau_ids_tags_exif[$nom_tag];
-
 
522
    		}
-
 
523
    		$tableau_exif_formate[$nom_tag] = array('id' => $id, 'valeur' => $valeur);
-
 
524
    	}
-
 
525
 
-
 
526
    	return $tableau_exif_formate;
-
 
527
    }
-
 
528
 
-
 
529
    /**
-
 
530
    * Extraction des metadonnées iptc
-
 
531
    **/
-
 
532
    public function extraireIptc($chemin_fichier) {
-
 
533
    	$meta = array();
-
 
534
 
-
 
535
        // getimagesize renvoie les infos iptc dans le tableau info
-
 
536
        $info = array();
-
 
537
        $size = getimagesize($chemin_fichier, $info);
-
 
538
 
-
 
539
        // s'il existe
-
 
540
        if (isset($info["APP13"])) {
-
 
541
            // on parse les donnees
-
 
542
            $iptc = iptcparse($info["APP13"]);
-
 
543
            if ($iptc) {
-
 
544
                // et on les analyse
-
 
545
                foreach ($iptc as $marker => $section) {
-
 
546
                    foreach ($section as $nom => $val) {
-
 
547
                        // pour remplir le tableau de donnees
-
 
548
                        $this->decoderValeurIptc($marker, $val, &$meta);
-
 
549
                    }
-
 
550
                }
-
 
551
            }
-
 
552
        }
-
 
553
 
-
 
554
        return $meta;
-
 
555
    }
-
 
556
 
-
 
557
    /**
-
 
558
    * Stocke une valeur de metadonnées iptc dans le champ du tableau correspondant
-
 
559
    * @param String $nom nom de la valeur
-
 
560
    * @param String $val valeur
-
 
561
    * @param String $data référence vers le tableau où la donnée sera stockée
-
 
562
    **/
-
 
563
    private function decoderValeurIptc($nom, $val, $data_tab) {
-
 
564
        switch ($nom) {
-
 
565
            case "2#005" :// mots cles iptc
-
 
566
                $data_tab['Category'] = array('id' => '5', 'valeur' => $val);
-
 
567
            	break;
-
 
568
            case "2#080" :// champ by line
-
 
569
                $data_tab['By-Line']  = array('id' => '80', 'valeur' => $val);
-
 
570
            	break ;
-
 
571
            case "2#085" :// champ by line titre
-
 
572
                $data_tab['By-LineTitle'] = array('id' => '85', 'valeur' => $val);
-
 
573
            	break ;
-
 
574
            case "2#090" :// ville
-
 
575
                $data_tab['City'] = array('id' => '90', 'valeur' => $val);
-
 
576
            	break ;
-
 
577
            case "2#092" :// sous location
-
 
578
                $data_tab['SubLocation'] = array('id' => '92', 'valeur' => $val);
-
 
579
            	break ;
-
 
580
            case "2#095" :// etat (pour les us)
-
 
581
                $data_tab['ProvinceState'] = array('id' => '95', 'valeur' => $val);
-
 
582
            	break ;
-
 
583
            case "2#100" :// code pays
-
 
584
                $data_tab['CountryPrimaryLocationCode'] = array('id' => '100', 'valeur' => $val);
-
 
585
            	break ;
-
 
586
            case "2#101" :// code pays
-
 
587
                $data_tab['CountryName'] = array('id' => '101', 'valeur' => $val);
-
 
588
            	break ;
-
 
589
            case "2#105" :// titre principal
-
 
590
                $data_tab['Headline'] = array('id' => '105', 'valeur' => $val);
-
 
591
            	break ;
-
 
592
            case "2#110" :// credit
-
 
593
                $data_tab['Credit'] = array('id' => '110', 'valeur' => $val);
-
 
594
            	break ;
-
 
595
            case "2#116" :// copyright
-
 
596
                $data_tab['CopyrightNotice'] = array('id' => '116', 'valeur' => $val);
-
 
597
            	break ;
-
 
598
            case "2#118" :// contact
-
 
599
                $data_tab['Contact'] = array('id' => '118', 'valeur' => $val);
-
 
600
            	break ;
-
 
601
            default:
-
 
602
            	unset($data_tab['nom']);
-
 
603
        }
-
 
604
    }
-
 
605
 
-
 
606
    private function obtenirHauteur() {
-
 
607
    	$hauteur = isset($this->meta['File']['ImageHeight']) ? $this->meta['File']['ImageHeight']['valeur'] : '';
-
 
608
    	return $hauteur;
-
 
609
    }
-
 
610
 
-
 
611
    private function obtenirLargeur() {
-
 
612
    	$largeur = isset($this->meta['File']['ImageWidth']) ? $this->meta['File']['ImageWidth']['valeur'] : '';
-
 
613
    	return $largeur;
-
 
614
    }
-
 
615
 
-
 
616
    private function obtenirDatePriseDeVue() {
-
 
617
    	$date = isset($this->meta['EXIF']['DateTimeOriginal']) ? $this->meta['EXIF']['DateTimeOriginal']['valeur'] : '';
-
 
618
    	return $date;
-
 
619
    }
-
 
620
 
-
 
621
    private function obtenirAppareilFabricant() {
-
 
622
    	$fabriquant = isset($this->meta['EXIF']['Make']) ? $this->meta['EXIF']['Make']['valeur'] : '';
-
 
623
    	return $fabriquant;
-
 
624
    }
-
 
625
 
-
 
626
    private function obtenirAppareilModele() {
-
 
627
    	$modele = isset($this->meta['EXIF']['CameraModelName']) ? $this->meta['EXIF']['CameraModelName']['valeur'] : '';
-
 
628
    	return $modele;
-
 
629
    }
-
 
630
 
-
 
631
    private function convertirMetaVersXML($type) {
-
 
632
    	$xml = null;
-
 
633
    	if (isset($this->meta[$type])) {
-
 
634
    		$racine = strtolower($type);
-
 
635
 
-
 
636
    		$xml = '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
-
 
637
    		$xml .= "<$racine>"."\n";
-
 
638
    		foreach ($this->meta[$type] as $prop => &$valeur) {
-
 
639
    			$xml .= '<'.$prop.' id="'.$valeur['id'].'">'.$valeur['valeur'].'</'.$prop.'>'."\n";
-
 
640
    		}
-
 
641
    		$xml .= "</$racine>";
-
 
642
    	}
-
 
643
    	return $xml;
-
 
644
    }
760
}
645
}
761
?> 
646
?>