Subversion Repositories eFlore/Applications.cel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1149 gduche 1
<?php
2
 
3
class MigrationImages extends Cel {
4
 
1160 aurelien 5
	public static $bdd_cel_migration;
6
	public static $bdd_utilisateurs;
7
 
8
	const truncate = true; //Doit on vider les tables de destination ?
9
 
1149 gduche 10
	const separateur_champs_metadonnees = ';';
11
	const separateur_valeurs_metadonnees = ':';
12
 
13
	private $id_cle_metadonnees = array();
14
 
15
	/** Tableau associatif permettant de stocker l'avancement dans une boucle.
16
	* La clé est un md5 du message à afficher au démarrage de la boucle.
17
	* @var array
18
	*/
19
	private static $avancement = array();
20
 
1160 aurelien 21
	const dry_run = false;
1149 gduche 22
 
23
	private $tableau_utilisateurs = array();
24
	private $tableau_observations = array();
25
	private $tableau_mots_cles = array();
26
 
27
	private $tableau_nouveau_ancien = array(
28
		'id_image' => 'ci_id_image',
29
		'ordre' =>'ci_ordre',
30
		'ce_utilisateur' => 'traiterIdentifiantUtilisateur',
31
		'prenom_utilisateur' => 'traiterPrenomUtilisateur',
32
		'nom_utilisateur' => 'traiterNomUtilisateur',
33
		'courriel_utilisateur' => 'ci_ce_utilisateur',
34
		'hauteur' => 'ci_meta_height',
35
		'largeur' => 'ci_meta_width',
36
		'appareil_fabriquant' => 'ci_meta_make',
37
		'appareil_modele' => 'ci_meta_model',
38
		'date_prise_de_vue' => 'ci_meta_date_time',
39
		'note_qualite' => 'ci_note_image',
40
		'mots_cles_texte' => 'traiterMotsClesTexte',
41
		'commentaire' => 'ci_meta_comment',
42
		'nom_original' => 'ci_nom_original',
43
		'md5' => 'ci_md5',
44
		'meta_exif' => 'traiterExif',
45
		'meta_iptc' => 'traiterIptc',
46
		'meta_xmp' => 'traiterXmp',
47
		'meta_makernote' => 'traiterMakernote',
48
		'date_modification' => 'ci_meta_date',
49
		'date_creation' => 'ci_meta_date_ajout'
50
	);
51
 
52
	private $champs_exifs_non_gardes = array(
53
		'ci_meta_x_resolution',
54
		'ci_meta_y_resolution',
55
		'ci_meta_gps',
56
		'ci_meta_user_comment',
57
		'ci_meta_exif_exposure_time',
58
		'ci_meta_exif_f_number',
59
		'ci_meta_exif_exif_version',
60
		'ci_meta_exif_compressed_bits_per_pixel',
61
		'ci_meta_exif_shutter_speed_value',
62
		'ci_meta_exif_aperture_value',
63
		'ci_meta_exif_exposure_bias_value',
64
		'ci_meta_exif_max_aperture_value',
65
		'ci_meta_exif_metering_mode',
66
		'ci_meta_exif_light_source',
67
		'ci_meta_exif_flash',
68
		'ci_meta_exif_focal_length',
69
		'ci_meta_exif_flash_pix_version',
70
		'ci_meta_exif_color_space',
71
		'ci_meta_exif_interoperability_offset',
72
		'ci_meta_exif_focal_plane_x_resolution',
73
		'ci_meta_exif_focal_plane_y_resolution',
74
		'ci_meta_exif_focal_plane_resolution_unit',
75
		'ci_meta_exif_sensing_method',
76
		'ci_meta_exif_file_source',
77
		'ci_meta_exif_custom_rendered',
78
		'ci_meta_exif_exposure_mode',
79
		'ci_meta_exif_white_balance',
80
		'ci_meta_exif_digital_zoom_ratio',
81
		'ci_meta_exif_scene_capture_type',
82
		'ci_meta_exif_gain_control',
83
		'ci_meta_exif_contrast',
84
		'ci_meta_exif_saturation',
85
		'ci_meta_exif_sharpness',
86
		'ci_meta_exif_subject_distance_range'
87
	);
88
 
89
	private $champs_iptc_non_gardes = array(
90
		'ci_meta_iptc_category',
91
		'ci_meta_iptc_by_line',
92
		'ci_meta_iptc_by_line_title',
93
		'ci_meta_iptc_city',
94
		'ci_meta_iptc_sub_location',
95
		'ci_meta_iptc_province_state',
96
		'ci_meta_iptc_country_primary_location_code',
97
		'ci_meta_iptc_country_name',
98
		'ci_meta_iptc_headline',
99
		'ci_meta_iptc_credit',
100
		'ci_meta_iptc_copyright_notice',
101
		'ci_meta_iptc_contact'
102
	);
103
 
104
	private $champs_divers_non_gardes = array(
105
		'ci_publiable_eflore',
106
		'ci_meta_mots_cles'
107
	);
108
 
109
	/**
110
	* Utiliser cette méthode dans une boucle pour afficher un message suivi du nombre de tour de boucle effectué.
111
	* Vous devrez vous même gérer le retour à la ligne à la sortie de la boucle.
112
	*
113
	* @param string le message d'information.
114
	* @param int le nombre de départ à afficher.
115
	* @return void le message est affiché dans la console.
116
	*/
117
	protected function afficherAvancement($message, $depart = 0) {
1160 aurelien 118
		if (! isset(self::$avancement[$message])) {
119
			self::$avancement[$message] = $depart;
120
			echo "$message : ";
121
 
122
			$actuel =& self::$avancement[$message];
123
			echo $actuel++;
124
		} else {
125
			$actuel =& self::$avancement[$message];
126
 
127
			// Cas du passage de 99 (= 2 caractères) à 100 (= 3 caractères)
128
			$passage = 0;
129
			if (strlen((string) ($actuel - 1)) < strlen((string) ($actuel))) {
130
			$passage = 1;
131
		}
132
 
133
			echo str_repeat(chr(8), (strlen((string) $actuel) - $passage));
134
			echo $actuel++;
135
		}
1149 gduche 136
	}
137
 
138
	/**
139
	 * Méthode appelée avec une requête de type GET.
140
	 */
141
	public function getElement($params) {
142
 
1160 aurelien 143
		if(!isset($this->config['database_cel']['database_migration']) || $this->config['database_cel']['database_migration'] == '') {
144
			echo 'Attention la variable de configuration database_migration dans la section database_cel, contenant la base de données d\'arrivée, doit être remplie '."\n";
145
			exit;
146
		}
147
 
148
		if(!isset($this->config['database_ident']['database']) || $this->config['database_ident']['database'] == '') {
149
			echo 'Attention la variable de configuration database dans la section database_ident, contenant la base de données utilisateurs, doit être remplie '."\n";
150
			exit;
151
		}
152
 
153
		self::$bdd_cel_migration = $this->config['database_cel']['database_migration'];
154
		self::$bdd_utilisateurs = $this->config['database_ident']['database'];
155
 
1149 gduche 156
		$this->id_cle_metadonnees = array_merge($this->tableau_ids_tags_exif, $this->tableau_ids_tags_iptc);
1160 aurelien 157
 
158
		echo "--MIGRATION DES IMAGES --------------------------------------\n";
159
		//1. TEMPORAIRE : vider les tables de destinations
160
		if (self::truncate) {
161
			echo "-------------------------------------------------------------------\n\n";
162
			echo "  ETAPE 0. Vider les tables ... \n\n";
163
			echo "-------------------------------------------------------------------\n\n";
164
			$nouvellesTables = array('`cel_images`', '`cel_obs_images`');
165
			foreach ($nouvellesTables as $nomTable) {
166
				echo 'Vider la table '.$nomTable.'...';
167
				$requeteTruncate = 'TRUNCATE TABLE '.self::$bdd_cel_migration.'.'.$nomTable;
168
				$resultatTruncate = $this->executerRequete($requeteTruncate);
169
				echo "ok \n";
170
			}
1149 gduche 171
 
1160 aurelien 172
			echo "\n---------------------------------------------------------------- OK\n\n";
173
		}
174
 
175
		echo "-------------------------------------------------------------------\n\n";
176
		echo "  ETAPE 1. Paramétrage ... \n\n";
177
		echo "-------------------------------------------------------------------\n\n";
1149 gduche 178
		$this->getUtilisateurs();
179
		$this->getMotsCles();
180
		$this->getObservations();
181
 
1160 aurelien 182
		echo "-------------------------------------------------------------------\n\n";
183
		echo "  ETAPE 2. Migration des images ... \n\n";
184
		echo "-------------------------------------------------------------------\n\n";
185
		$this->migrerImages();
1149 gduche 186
		echo "\n"."\n"."\n";
187
 
1160 aurelien 188
		echo "-------------------------------------------------------------------\n\n";
189
		echo "  ETAPE 3. migration des liaisons obs images ... \n\n";
190
		echo "-------------------------------------------------------------------\n\n";
191
		//$this->migrerLiaisonsObsImages();
1149 gduche 192
		echo "\n"."\n"."\n";
193
	}
194
 
195
	private function getUtilisateurs() {
1160 aurelien 196
		echo "\n-------------------------------------------------------------------\n";
197
		echo "--SELECTION DES UTILISATEURS---------------------------------------\n\n";
1149 gduche 198
 
1160 aurelien 199
		$requete_selection_utilisateurs = 'SELECT U_ID as id, U_MAIL as mail, U_NAME as nom, U_SURNAME as prenom, U_PASSWD as pass FROM '.self::$bdd_utilisateurs.'.annuaire_tela';
1149 gduche 200
		$tableau_utilisateurs = $this->executerRequete($requete_selection_utilisateurs);
201
 
202
		foreach( $tableau_utilisateurs as &$utilisateur) {
203
			$this->tableau_utilisateurs[$utilisateur['mail']] = $utilisateur;
204
		}
205
 
1160 aurelien 206
		echo sizeof($this->tableau_utilisateurs)." utilisateurs sélectionnés";
207
		echo "\n-----------------------------------------------------------------OK\n";
1149 gduche 208
	}
209
 
210
	private function getMotsCles() {
1160 aurelien 211
		echo "\n-------------------------------------------------------------------\n";
212
		echo "--SELECTION DES MOTS-CLES -----------------------------------------\n\n";
1149 gduche 213
 
1160 aurelien 214
		$requete_selection_mots_cles = 'SELECT cmc_id_proprietaire as id_utilisateur, cmc_id_mot_cle_utilisateur as id_mot_cle, cmc_mot_cle as mot_cle FROM cel_mots_cles_obs';
1149 gduche 215
		$tableau_mots_cles = $this->executerRequete($requete_selection_mots_cles);
216
 
1160 aurelien 217
		foreach( $tableau_mots_cles as &$mot_cle) {
1149 gduche 218
			$this->tableau_mots_cles[$mot_cle['id_utilisateur']][$mot_cle['id_mot_cle']] = $mot_cle;
219
		}
1160 aurelien 220
 
221
		echo sizeof($this->tableau_mots_cles)." mots-clés sélectionnés";
222
		echo "\n-----------------------------------------------------------------OK\n";
223
 
1149 gduche 224
	}
225
 
226
	private function getObservations() {
1160 aurelien 227
 
1149 gduche 228
		$pas = 5000;
229
 
230
		$nObs = "SELECT COUNT(*) AS nb FROM cel_inventory";
231
		$resultatNbObs = $this->executerRequete($nObs);
232
		$nbObs = $resultatNbObs[0]['nb'];
233
 
234
		for ($i = 0; $i < 230000; $i += $pas ) {
235
			$requete_selection_observations = 'SELECT id, ordre, identifiant FROM cel_inventory LIMIT '.$i.", $pas";
236
			$tableau_observations = $this->executerRequete($requete_selection_observations);
237
			foreach($tableau_observations as &$obs) {
238
				$this->tableau_observations[$obs['identifiant']][$obs['ordre']] = $obs['id'];
239
			}
240
 
1160 aurelien 241
			$this->afficherAvancement('Selection des observations (par '.$pas.' )', $nbObs);
1149 gduche 242
		}
243
 
1160 aurelien 244
		echo "\n\n";
1149 gduche 245
	}
246
 
247
	public function executerRequeteSimple($requete) {
248
		// Fonction de commodité pour afficher les requetes au lieu de les executer
249
		if (self::dry_run) {
250
			echo str_replace('),','),'."\n", $requete)."\n";
251
			return true;
252
		} else {
253
			return parent::executerRequeteSimple($requete);
254
		}
255
	}
256
 
257
	private function migrerImages() {
258
 
259
		$debut = 0;
260
		$pas = 200;
261
		$fin = 150000;
262
 
1160 aurelien 263
		//Selectionner le nombre d'images
264
		$requeteNbImg = "SELECT COUNT(*) as nb FROM cel_images";
265
		$resultatNbImg = $this->executerRequete($requeteNbImg);
266
		$fin = $resultatNbImg[0]['nb'];
267
 
1149 gduche 268
		for ($i = $debut; $i <= $fin ; $i += $pas) {
269
			$requete_selection_images = 'SELECT * FROM cel_images '.
270
											'ORDER BY ci_id_image ASC LIMIT '.$i.','.$pas;
271
 
1160 aurelien 272
			$images = @$this->requeter($requete_selection_images);
1149 gduche 273
 
1160 aurelien 274
			$requete_insertion_images = 'INSERT INTO '.self::$bdd_cel_migration.'.cel_images (';
1149 gduche 275
			foreach ($this->tableau_nouveau_ancien as $nouveau_champ => $ancien_champ) {
276
				$requete_insertion_images .= $nouveau_champ.',';
277
			}
278
			$requete_insertion_images = rtrim($requete_insertion_images, ',');
279
 
280
			$requete_insertion_images = $requete_insertion_images.') VALUES ';
281
 
282
			if (is_array($images)) {
283
 
284
				$nb_images_a_traiter = count($images);
285
 
286
				foreach($images as $image) {
287
 
288
					$nouvelle_image = $this->traiterLigneImage($image);
289
 
290
					$nouvelle_image = array_map(array($this,'proteger'),$nouvelle_image);
291
					$requete_insertion_images .= '('.join(',',array_values($nouvelle_image)).'),';
292
				}
293
 
294
				$requete_insertion_images = rtrim($requete_insertion_images, ',');
295
				$migration_images = $this->executer($requete_insertion_images);
296
 
297
				if (!$migration_images) {
298
					echo 'la migration des images '.$i.' à '.($i+$nb_images_a_traiter).' a échoué '."\n";
299
				} else {
1160 aurelien 300
					$this->afficherAvancement('Migration des images (par '.$pas.' )', $fin);
1149 gduche 301
				}
302
			}
303
 
304
			if(count($images) < $pas) {
1160 aurelien 305
				echo "\n---------------------------------------------------------------- OK\n\n";
1149 gduche 306
				return;
307
			}
308
		}
309
	}
310
 
311
	private function migrerLiaisonsObsImages() {
312
		$debut = 0;
1160 aurelien 313
		$pas = 500;
1149 gduche 314
		$fin = 50000;
315
 
1160 aurelien 316
		$liaisons_obs_inexistantes = 0;
317
 
318
		//Selectionner le nombre de liaisons
319
		$requeteNbImgObs = "SELECT COUNT(*) as nb FROM cel_obs_images";
320
		$resultatNbImgObs = $this->executerRequete($requeteNbImgObs);
321
		$fin = $resultatNbImgObs[0]['nb'];
322
 
1149 gduche 323
		for ($i = $debut; $i <= $fin ; $i += $pas) {
1160 aurelien 324
 
325
			if($i > $fin) {
326
				$i = $fin;
327
			}
328
 
1149 gduche 329
			$requete_selection_liaisons = 'SELECT * FROM cel_obs_images LIMIT '.$i.','.$pas;
330
			$tableau_liaisons = $this->executerRequete($requete_selection_liaisons);
331
 
1160 aurelien 332
			$requete_migration_liaison = 'INSERT INTO '.self::$bdd_cel_migration.'.cel_obs_images '.
333
											'(id_image, id_utilisateur, id_observation, date_liaison) '.
1149 gduche 334
											'VALUES ';
335
 
336
			$sous_requete_insertion = '';
337
 
1160 aurelien 338
			if(is_array($tableau_liaisons)) {
339
				foreach($tableau_liaisons as &$liaison) {
340
 
341
					$mail_utilisateur = $liaison['coi_ce_utilisateur'];
342
					$utilisateur = $mail_utilisateur;
1149 gduche 343
 
1160 aurelien 344
					if (isset($this->tableau_utilisateurs[$mail_utilisateur])) {
345
						$utilisateur =  $this->tableau_utilisateurs[$mail_utilisateur]['id'];
346
					}
347
 
348
					$id_obs = $liaison['coi_ce_observation'];
349
 
350
					if (isset($this->tableau_observations[$mail_utilisateur][$id_obs])) {
351
						$id_obs =  $this->tableau_observations[$mail_utilisateur][$id_obs];
352
 
353
						$sous_requete_insertion .= '('.$this->proteger($liaison['coi_ce_image']).','.
354
							$this->proteger($utilisateur).','.
355
							$this->proteger($id_obs).','.
356
							$this->proteger($liaison['coi_date_liaison']).
357
						'),';
358
					} else {
359
						// cas d'une observation inexistante, la liaison est ignorée
360
						$liaisons_obs_inexistantes++;
361
					}
1149 gduche 362
				}
363
 
1160 aurelien 364
				$sous_requete_insertion = rtrim($sous_requete_insertion,',');
365
				$requete_migration_liaison = $requete_migration_liaison.$sous_requete_insertion;
366
 
367
				$migration_liaison = $this->executerRequeteSimple($requete_migration_liaison);
368
 
369
				if (!$migration_liaison) {
370
					echo 'la migration des liaisons obs images de '.$i.' à '.($i+$pas).' a échoué ! '."\n<br />";
1149 gduche 371
				} else {
1160 aurelien 372
					$this->afficherAvancement('Migration des liaisons obs images (par '.$pas.' )', $fin);
373
				}
1149 gduche 374
			}
375
		}
1160 aurelien 376
		echo "\n\n";
377
		echo $liaisons_obs_inexistantes ? $liaisons_obs_inexistantes." liaisons image obs ont été ignorées car les obs sont absentes" : '' ;
378
		echo "\n";
379
		echo "\n---------------------------------------------------------------- OK\n\n";
1149 gduche 380
	}
381
 
382
	private function traiterLigneImage($image) {
383
 
384
		$nouvelle_image = array();
385
 
386
		foreach ($this->tableau_nouveau_ancien as $nouveau_champ_image => $ancien_champ_image) {
387
 
388
			if ($this->estUnChampATraiter($ancien_champ_image)) {
389
				if (method_exists($this,$ancien_champ_image)) {
390
					$nouvelle_image[$nouveau_champ_image] = $this->$ancien_champ_image($image);
391
				} else {
392
					echo 'methode manquante : '.$ancien_champ_image."\n";
393
					$nouvelle_image[$nouveau_champ_image] = '';
394
				}
395
 
396
			} else {
397
				$nouvelle_image[$nouveau_champ_image] = $image[$ancien_champ_image];
398
			}
399
		}
400
 
401
		return $nouvelle_image;
402
	}
403
 
404
	private function estUnChampATraiter($champ) {
405
 
406
		return strpos($champ, 'traiter') !== false;
407
	}
408
 
409
	private function traiterMotsClesTexte($ligne_image) {
410
 
411
		$mail_image = $ligne_image['ci_ce_utilisateur'];
412
		$retour = $ligne_image['ci_meta_mots_cles'];
413
 
414
		if (isset($this->tableau_mots_cles[$mail_image])) {
415
 
416
			$mots_cles_tableau = $this->parserMotsCles($mail_image, $ligne_image['ci_meta_mots_cles'], ',');
417
			$retour =  join(';',$mots_cles_tableau);
418
			$retour = ltrim($retour,';;') ;
419
		}
420
 
421
		return $retour;
422
	}
423
 
424
	private function parserMotsCles($utilisateur, $mot_cles, $separateur = ',') {
425
 
426
		$tableau_mots_cles = explode($separateur,$mot_cles);
427
		$tableau_mots_cles_formates = array();
428
 
429
		foreach($tableau_mots_cles as $mot_cle) {
430
 
431
			$mot_cle = str_replace($separateur.$separateur,'',$mot_cle);
432
			$mot_cle = str_replace('null','',$mot_cle);
433
 
434
			if ($this->estUnIdentifiantMotCle($mot_cle)) {
435
 
436
				// certains mots clés mal formatés contiennent des virgules
437
				if (strpos($mot_cle,',') !== false) {
438
					$tab_mot_cle_mal_formate = explode(',',$mot_cle);
439
 
440
					foreach ($tab_mot_cle_mal_formate as $mot_cle_mal_formate) {
441
						if ($this->estUnIdentifiantMotCle($mot_cle_mal_formate)) {
442
							$tableau_mots_cles_formates[$mot_cle_mal_formate] = $this->tableau_mots_cles[$utilisateur][$mot_cle_mal_formate]['mot_cle'];
443
						}
444
					}
445
				} else {
446
					// on met le mot clé dans sa propre case afin d'éviter
447
					// facilement les doublons provoqués par de mauvais formatages
1160 aurelien 448
					if(isset($this->tableau_mots_cles[$utilisateur][$mot_cle])) {
449
						$tableau_mots_cles_formates[$mot_cle] = $this->tableau_mots_cles[$utilisateur][$mot_cle]['mot_cle'];
450
					}
1149 gduche 451
				}
452
 
453
			}
454
		}
455
 
456
		return $tableau_mots_cles_formates;
457
	}
458
 
459
	private function estUnIdentifiantMotCle($chaine) {
460
		return trim($chaine) != '' && preg_match('/[0-9A-Z]+\.[0-9A-Z]+/i', $chaine) ;
461
	}
462
 
463
	private function traiterIdentifiantUtilisateur($ligne_image) {
464
 
465
		$mail_image = $ligne_image['ci_ce_utilisateur'];
466
		$retour = $mail_image;
467
 
468
		if (isset($this->tableau_utilisateurs[$mail_image])) {
469
			$retour =  $this->tableau_utilisateurs[$mail_image]['id'];
470
		}
471
 
472
		return $retour;
473
	}
474
 
475
	private function traiterPrenomUtilisateur($ligne_image) {
476
 
477
		$mail_image = $ligne_image['ci_ce_utilisateur'];
478
		$retour = $mail_image;
479
 
480
		if (isset($this->tableau_utilisateurs[$mail_image])) {
481
			$retour =  $this->tableau_utilisateurs[$mail_image]['prenom'];
482
		}
483
 
484
		return $retour;
485
	}
486
 
487
	private function traiterNomUtilisateur($ligne_image) {
488
 
489
		$mail_image = $ligne_image['ci_ce_utilisateur'];
490
		$retour = $mail_image;
491
 
492
		if (isset($this->tableau_utilisateurs[$mail_image])) {
493
			$retour =  $this->tableau_utilisateurs[$mail_image]['nom'];
494
		}
495
 
496
		return $retour;
497
	}
498
 
499
	private function decoderTableauMetaDonnees($chaine) {
500
 
501
		$tableau_valeurs_decodees = array();
502
 
503
		if (trim($chaine) != '') {
504
			$tableau_meta = explode(self::separateur_champs_metadonnees,$chaine);
505
			foreach ($tableau_meta as &$chaine_meta) {
506
 
507
				$cle_valeur = explode(self::separateur_valeurs_metadonnees, $chaine_meta);
508
				if (is_array($cle_valeur) && count($cle_valeur) == 2) {
509
					$cle = ltrim($cle_valeur[0],' ');
510
					$tableau_valeurs_decodees[$cle] = $cle_valeur[1];
511
				}
512
			}
513
		}
514
 
515
		return $tableau_valeurs_decodees;
516
	}
517
 
518
	private function convertirTableauMetadonneesEnXml($tableau) {
519
 
520
		$xml = '';
521
 
1160 aurelien 522
		foreach($tableau as $cle => $valeur) {
1149 gduche 523
 
524
			$cle = str_replace('ci_meta_exif_','',$cle);
525
			$cle = str_replace('ci_meta_iptc_','',$cle);
526
			$cle = str_replace('ci_meta_','',$cle);
527
			$cle = str_replace('_',' ',$cle);
528
			$cle = str_replace(' ','',ucwords($cle));
529
			$valeur = str_replace("\0",'',$valeur);
1160 aurelien 530
			$id = isset($this->id_cle_metadonnees[$cle]) ? $this->id_cle_metadonnees[$cle] : $cle;
531
			$xml .= '<'.$cle.' id="'.$id.'">'.$valeur.'</'.$cle.'>'."\n";
532
		}
1149 gduche 533
 
534
		return $xml;
535
	}
536
 
537
	private function peutUtiliserExifTool() {
538
		return file_exists('/usr/bin/exiftool') && is_executable('/usr/bin/exiftool');
539
	}
540
 
541
	private function decoderMetadonnees($chemin_image) {
542
 
543
		$res = '';
544
 
545
		if($this->peutUtiliserExifTool()) {
546
			$res = $this->decoderMetadonneesExifTool($chemin_image);
547
 
548
			$xml_meta = '<?xml version="1.0" encoding="UTF-8" ?>';
549
			$xml_meta .= '<exif>';
550
 
551
			foreach($res['EXIF'] as $prop => $valeur) {
552
				$xml_meta .= '    <'.$prop.' id="'.$valeur['id'].'">'.$valeur['valeur'].'</'.$prop.'>'."\n";
553
			}
554
			$xml_meta .= '</exif>'."\n";
555
 
556
			$xml_meta .= '<iptc>';
557
			foreach($res['IPTC'] as $prop => $valeur) {
558
				$xml_meta .= '    <'.$prop.' id="'.$valeur['id'].'">'.$valeur['valeur'].'</'.$prop.'>'."\n";
559
			}
560
			$xml_meta .= '</iptc>'."\n";
561
 
562
			$xml_meta .= '<xmp>';
563
			foreach($res['XMP'] as $prop => $valeur) {
564
				$xml_meta .= '    <'.$prop.' id="'.$valeur['id'].'">'.$valeur['valeur'].'</'.$prop.'>'."\n";
565
			}
566
			$xml_meta .= '</xmp>'."\n";
567
		} else {
568
 
569
		}
570
 
571
		return $xml_meta;
572
	}
573
 
574
	private function decoderMetadonneesExifTool($chemin_image) {
575
		$metadata = array();
576
		$res = exec('/usr/bin/exiftool -g -D '.$chemin_image, $metadata);
577
 
578
		$metadata_decodees = array();
579
 
580
		$categorie = '';
581
		foreach($metadata as &$data) {
582
			if($this->estUnSeparateurCategorieExifTool($data)) {
583
				$categorie = trim(str_replace('----','',$data));
584
			} else {
585
				$data_decodee = $this->parserValeurMetadonneeExifTool($data);
586
				$cle_metadonnee = str_replace(' ', '', $data_decodee['cle']);
587
				$metadata_decodees[$categorie][$cle_metadonnee] = $data_decodee;
588
				$this->id_cle_metadonnees[$cle_metadonnee] = $data_decodee['id'];
589
			}
590
		}
591
 
592
		return $metadata_decodees;
593
	}
594
 
595
	private function estUnSeparateurCategorieExifTool($data) {
596
		return preg_match('^---- (.)* ----^',$data);
597
	}
598
 
599
	private function parserValeurMetadonneeExifTool($data) {
600
		$cle_valeur = explode(':',$data);
601
 
602
		$valeur = '';
603
		if(count($cle_valeur) == 2) {
604
			$valeur	= trim($cle_valeur[1]);
605
		}
606
 
607
		$id_cle = explode(' ',trim($cle_valeur[0]),2);
608
 
609
		$id_cle[1] = str_replace(array('-','/'),'',$id_cle[1]);
610
 
611
		$cle_id_valeur = array('cle' => $id_cle[1], 'id' => str_replace('-','',$id_cle[0]), 'valeur' => $valeur);
612
		return $cle_id_valeur;
613
	}
614
 
615
	private function traiterExif($ligne_image) {
616
 
617
		$metadonnees_autres = $this->decoderTableauMetaDonnees($ligne_image['ci_meta_exif_autres']);
618
		$metadonnees = array_intersect_key($ligne_image, array_flip($this->champs_exifs_non_gardes))+$metadonnees_autres;
619
 
620
		$xml_meta = '<?xml version="1.0" encoding="UTF-8" ?>';
621
		$xml_meta .= '<exif>';
622
		$xml_meta .= $this->convertirTableauMetadonneesEnXml($metadonnees);
623
		$xml_meta .= '</exif>';
624
 
625
		return $xml_meta;
626
	}
627
 
628
	private function traiterIptc($ligne_image) {
629
 
630
		$metadonnees_autres = $this->decoderTableauMetaDonnees($ligne_image['ci_meta_iptc_autres']);
631
		$metadonnees = array_intersect_key($ligne_image, array_flip($this->champs_iptc_non_gardes))+$metadonnees_autres;
632
 
633
		$xml_meta = '<?xml version="1.0" encoding="UTF-8" ?>';
634
		$xml_meta .= '<iptc>';
635
		$xml_meta .= $this->convertirTableauMetadonneesEnXml($metadonnees);
636
		$xml_meta .= '</iptc>';
637
 
638
		return $xml_meta;
639
	}
640
 
641
	private function traiterXmp($ligne_image) {
642
 
643
		$chemin = $this->obtenirCheminImageOriginale($ligne_image['ci_id_image']);
1160 aurelien 644
		// TODO décommenté car pour le moment ça n'est pas necessaire, à éxécuter à part
1149 gduche 645
		//$res = $this->decoderMetadonneesExifTool($chemin);
646
		$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
647
		$xml .= '<xmp>';
648
		if (isset($res['XMP'])) {
649
			foreach ($res['XMP'] as $prop => $valeur) {
650
				$xml .= '    <'.$prop.' id="'.$valeur['id'].'">'.$valeur['valeur'].'</'.$prop.'>'."\n";
651
			}
652
		}
653
		$xml .= '</xmp>';
654
 
655
		return $xml;
656
	}
657
 
658
	private function traiterMakernote($ligne_image) {
659
 
660
		$chemin = $this->obtenirCheminImageOriginale($ligne_image['ci_id_image']);
661
		//$res = $this->decoderMetadonneesExifTool($chemin);
662
		$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
663
		$xml .= '<makernote>';
664
		if (isset($res['MAKERNOTE'])) {
665
			foreach ($res['MAKERNOTE'] as $prop => $valeur) {
666
				$xml .= '    <'.$prop.' id="'.$valeur['id'].'">'.$valeur['valeur'].'</'.$prop.'>'."\n";
667
			}
668
		}
669
		$xml .= '</makernote>';
670
 
671
		return '';
672
	}
673
 
674
	public function obtenirCheminImageOriginale($id_image) {
675
		$nom = $this->convertirIdBddVersNomFichier($id_image, 'O');
676
		$dossier = $this->obtenirDossierPourFormat($id_image,'O');
677
 
678
		return $dossier.'/'.$nom;
679
	}
680
 
681
	public function convertirIdBddVersNomFichier($id, $format, $extension = 'jpg') {
682
		// creation du format original
683
		$id_avec_zeros = sprintf('%09s', $id) ;
684
		$id_avec_zeros_underscores = wordwrap($id_avec_zeros, 3 , '_', true) ;
685
 
686
		$nom_fichier = $id_avec_zeros_underscores.'_'.$format.'.'.$extension;
687
 
688
		return $nom_fichier;
689
	}
690
 
691
	public function obtenirDossierPourFormat($id, $format) {
692
		$chemin_base = $this->config['cel']['chemin_images'];
693
 
694
		$chemin_sur_serveur = $chemin_base;
695
 
696
		$id = sprintf('%09s', $id);
697
		$id = wordwrap($id, 3 , '_', true);
698
 
699
		list($dossierNiveau1, $dossierNiveau2) = explode('_', $id);
700
 
701
		$chemin_sur_serveur_final = $chemin_sur_serveur.'/'.$dossierNiveau1.'/'.$dossierNiveau2.'/'.$format;
702
 
703
		return $chemin_sur_serveur_final;
704
	}
705
 
706
	private $tableau_ids_tags_exif = array('InteropIndex' => '1',
707
		'InteropVersion' => '2',
708
		'ProcessingSoftware' => '11',
709
		'SubfileType' => '254',
710
		'OldSubfileType' => '255',
711
		'ImageWidth' => '256',
712
		'ImageHeight' => '257',
713
		'BitsPerSample' => '258',
714
		'Compression' => '259',
715
		'PhotometricInterpretation' => '262',
716
		'Thresholding' => '263',
717
		'CellWidth' => '264',
718
		'CellLength' => '265',
719
		'FillOrder' => '266',
720
		'DocumentName' => '269',
721
		'ImageDescription' => '270',
722
		'Make' => '271',
723
		'Model' => '272',
724
		'StripOffsets' => '273',
725
		'Orientation' => '274',
726
		'SamplesPerPixel' => '277',
727
		'RowsPerStrip' => '278',
728
		'StripByteCounts' => '279',
729
		'MinSampleValue' => '280',
730
		'MaxSampleValue' => '281',
731
		'XResolution' => '282',
732
		'YResolution' => '283',
733
		'PlanarConfiguration' => '284',
734
		'PageName' => '285',
735
		'XPosition' => '286',
736
		'YPosition' => '287',
737
		'FreeOffsets' => '288',
738
		'FreeByteCounts' => '289',
739
		'GrayResponseUnit' => '290',
740
		'GrayResponseCurve' => '291',
741
		'T4Options' => '292',
742
		'T6Options' => '293',
743
		'ResolutionUnit' => '296',
744
		'PageNumber' => '297',
745
		'ColorResponseUnit' => '300',
746
		'TransferFunction' => '301',
747
		'Software' => '305',
748
		'ModifyDate' => '306',
749
		'Artist' => '315',
750
		'HostComputer' => '316',
751
		'Predictor' => '317',
752
		'WhitePoint' => '318',
753
		'PrimaryChromaticities' => '319',
754
		'ColorMap' => '320',
755
		'HalftoneHints' => '321',
756
		'TileWidth' => '322',
757
		'TileLength' => '323',
758
		'TileOffsets' => '324',
759
		'TileByteCounts' => '325',
760
		'BadFaxLines' => '326',
761
		'CleanFaxData' => '327',
762
		'ConsecutiveBadFaxLines' => '328',
763
		'SubIFD' => '330',
764
		'InkSet' => '332',
765
		'InkNames' => '333',
766
		'NumberofInks' => '334',
767
		'DotRange' => '336',
768
		'TargetPrinter' => '337',
769
		'ExtraSamples' => '338',
770
		'SampleFormat' => '339',
771
		'SMinSampleValue' => '340',
772
		'SMaxSampleValue' => '341',
773
		'TransferRange' => '342',
774
		'ClipPath' => '343',
775
		'XClipPathUnits' => '344',
776
		'YClipPathUnits' => '345',
777
		'Indexed' => '346',
778
		'JPEGTables' => '347',
779
		'OPIProxy' => '351',
780
		'GlobalParametersIFD' => '400',
781
		'ProfileType' => '401',
782
		'FaxProfile' => '402',
783
		'CodingMethods' => '403',
784
		'VersionYear' => '404',
785
		'ModeNumber' => '405',
786
		'Decode' => '433',
787
		'DefaultImageColor' => '434',
788
		'T82Options' => '435',
789
		'JPEGTables' => '437',
790
		'JPEGProc' => '512',
791
		'ThumbnailOffset' => '513',
792
		'ThumbnailLength' => '514',
793
		'JPEGRestartInterval' => '515',
794
		'JPEGLosslessPredictors' => '517',
795
		'JPEGPointTransforms' => '518',
796
		'JPEGQTables' => '519',
797
		'JPEGDCTables' => '520',
798
		'JPEGACTables' => '521',
799
		'YCbCrCoefficients' => '529',
800
		'YCbCrSubSampling' => '530',
801
		'YCbCrPositioning' => '531',
802
		'ReferenceBlackWhite' => '532',
803
		'StripRowCounts' => '559',
804
		'ApplicationNotes' => '700',
805
		'USPTOMiscellaneous' => '999',
806
		'RelatedImageFileFormat' => '4096',
807
		'RelatedImageWidth' => '4097',
808
		'RelatedImageHeight' => '4098',
809
		'Rating' => '18246',
810
		'XP_DIP_XML' => '18247',
811
		'StitchInfo' => '18248',
812
		'RatingPercent' => '18249',
813
		'ImageID' => '32781',
814
		'WangTag1' => '32931',
815
		'WangAnnotation' => '32932',
816
		'WangTag3' => '32933',
817
		'WangTag4' => '32934',
818
		'Matteing' => '32995',
819
		'DataType' => '32996',
820
		'ImageDepth' => '32997',
821
		'TileDepth' => '32998',
822
		'Model2' => '33405',
823
		'CFARepeatPatternDim' => '33421',
824
		'CFAPattern2' => '33422',
825
		'BatteryLevel' => '33423',
826
		'KodakIFD' => '33424',
827
		'Copyright' => '33432',
828
		'ExposureTime' => '33434',
829
		'FNumber' => '33437',
830
		'MDFileTag' => '33445',
831
		'MDScalePixel' => '33446',
832
		'MDColorTable' => '33447',
833
		'MDLabName' => '33448',
834
		'MDSampleInfo' => '33449',
835
		'MDPrepDate' => '33450',
836
		'MDPrepTime' => '33451',
837
		'MDFileUnits' => '33452',
838
		'PixelScale' => '33550',
839
		'AdventScale' => '33589',
840
		'AdventRevision' => '33590',
841
		'UIC1Tag' => '33628',
842
		'UIC2Tag' => '33629',
843
		'UIC3Tag' => '33630',
844
		'UIC4Tag' => '33631',
845
		'IPTC-NAA' => '33723',
846
		'IntergraphPacketData' => '33918',
847
		'IntergraphFlagRegisters' => '33919',
848
		'IntergraphMatrix' => '33920',
849
		'INGRReserved' => '33921',
850
		'ModelTiePoint' => '33922',
851
		'Site' => '34016',
852
		'ColorSequence' => '34017',
853
		'IT8Header' => '34018',
854
		'RasterPadding' => '34019',
855
		'BitsPerRunLength' => '34020',
856
		'BitsPerExtendedRunLength' => '34021',
857
		'ColorTable' => '34022',
858
		'ImageColorIndicator' => '34023',
859
		'BackgroundColorIndicator' => '34024',
860
		'ImageColorValue' => '34025',
861
		'BackgroundColorValue' => '34026',
862
		'PixelIntensityRange' => '34027',
863
		'TransparencyIndicator' => '34028',
864
		'ColorCharacterization' => '34029',
865
		'HCUsage' => '34030',
866
		'TrapIndicator' => '34031',
867
		'CMYKEquivalent' => '34032',
868
		'SEMInfo' => '34118',
869
		'AFCP_IPTC' => '34152',
870
		'PixelMagicJBIGOptions' => '34232',
871
		'ModelTransform' => '34264',
872
		'WB_GRGBLevels' => '34306',
873
		'LeafData' => '34310',
874
		'PhotoshopSettings' => '34377',
875
		'ExifOffset' => '34665',
876
		'ICC_Profile' => '34675',
877
		'TIFF_FXExtensions' => '34687',
878
		'MultiProfiles' => '34688',
879
		'SharedData' => '34689',
880
		'T88Options' => '34690',
881
		'ImageLayer' => '34732',
882
		'GeoTiffDirectory' => '34735',
883
		'GeoTiffDoubleParams' => '34736',
884
		'GeoTiffAsciiParams' => '34737',
885
		'ExposureProgram' => '34850',
886
		'SpectralSensitivity' => '34852',
887
		'GPSInfo' => '34853',
888
		'ISO' => '34855',
889
		'Opto-ElectricConvFactor' => '34856',
890
		'Interlace' => '34857',
891
		'TimeZoneOffset' => '34858',
892
		'SelfTimerMode' => '34859',
893
		'SensitivityType' => '34864',
894
		'StandardOutputSensitivity' => '34865',
895
		'RecommendedExposureIndex' => '34866',
896
		'ISOSpeed' => '34867',
897
		'ISOSpeedLatitudeyyy' => '34868',
898
		'ISOSpeedLatitudezzz' => '34869',
899
		'FaxRecvParams' => '34908',
900
		'FaxSubAddress' => '34909',
901
		'FaxRecvTime' => '34910',
902
		'LeafSubIFD' => '34954',
903
		'ExifVersion' => '36864',
904
		'DateTimeOriginal' => '36867',
905
		'CreateDate' => '36868',
906
		'ComponentsConfiguration' => '37121',
907
		'CompressedBitsPerPixel' => '37122',
908
		'ShutterSpeedValue' => '37377',
909
		'ApertureValue' => '37378',
910
		'BrightnessValue' => '37379',
911
		'ExposureCompensation' => '37380',
912
		'MaxApertureValue' => '37381',
913
		'SubjectDistance' => '37382',
914
		'MeteringMode' => '37383',
915
		'LightSource' => '37384',
916
		'Flash' => '37385',
917
		'FocalLength' => '37386',
918
		'FlashEnergy' => '37387',
919
		'SpatialFrequencyResponse' => '37388',
920
		'Noise' => '37389',
921
		'FocalPlaneXResolution' => '37390',
922
		'FocalPlaneYResolution' => '37391',
923
		'FocalPlaneResolutionUnit' => '37392',
924
		'ImageNumber' => '37393',
925
		'SecurityClassification' => '37394',
926
		'ImageHistory' => '37395',
927
		'SubjectArea' => '37396',
928
		'ExposureIndex' => '37397',
929
		'TIFF-EPStandardID' => '37398',
930
		'SensingMethod' => '37399',
931
		'CIP3DataFile' => '37434',
932
		'CIP3Sheet' => '37435',
933
		'CIP3Side' => '37436',
934
		'StoNits' => '37439',
935
		'MakerNoteCanon' => '37500',
936
		'UserComment' => '37510',
937
		'SubSecTime' => '37520',
938
		'SubSecTimeOriginal' => '37521',
939
		'SubSecTimeDigitized' => '37522',
940
		'MSDocumentText' => '37679',
941
		'MSPropertySetStorage' => '37680',
942
		'MSDocumentTextPosition' => '37681',
943
		'ImageSourceData' => '37724',
944
		'XPTitle' => '40091',
945
		'XPComment' => '40092',
946
		'XPAuthor' => '40093',
947
		'XPKeywords' => '40094',
948
		'XPSubject' => '40095',
949
		'FlashpixVersion' => '40960',
950
		'ColorSpace' => '40961',
951
		'ExifImageWidth' => '40962',
952
		'ExifImageHeight' => '40963',
953
		'RelatedSoundFile' => '40964',
954
		'InteropOffset' => '40965',
955
		'FlashEnergy' => '41483',
956
		'SpatialFrequencyResponse' => '41484',
957
		'Noise' => '41485',
958
		'FocalPlaneXResolution' => '41486',
959
		'FocalPlaneYResolution' => '41487',
960
		'FocalPlaneResolutionUnit' => '41488',
961
		'ImageNumber' => '41489',
962
		'SecurityClassification' => '41490',
963
		'ImageHistory' => '41491',
964
		'SubjectLocation' => '41492',
965
		'ExposureIndex' => '41493',
966
		'TIFF-EPStandardID' => '41494',
967
		'SensingMethod' => '41495',
968
		'FileSource' => '41728',
969
		'SceneType' => '41729',
970
		'CFAPattern' => '41730',
971
		'CustomRendered' => '41985',
972
		'ExposureMode' => '41986',
973
		'WhiteBalance' => '41987',
974
		'DigitalZoomRatio' => '41988',
975
		'FocalLengthIn35mmFormat' => '41989',
976
		'SceneCaptureType' => '41990',
977
		'GainControl' => '41991',
978
		'Contrast' => '41992',
979
		'Saturation' => '41993',
980
		'Sharpness' => '41994',
981
		'DeviceSettingDescription' => '41995',
982
		'SubjectDistanceRange' => '41996',
983
		'ImageUniqueID' => '42016',
984
		'OwnerName' => '42032',
985
		'SerialNumber' => '42033',
986
		'LensInfo' => '42034',
987
		'LensMake' => '42035',
988
		'LensModel' => '42036',
989
		'LensSerialNumber' => '42037',
990
		'GDALMetadata' => '42112',
991
		'GDALNoData' => '42113',
992
		'Gamma' => '42240',
993
		'ExpandSoftware' => '44992',
994
		'ExpandLens' => '44993',
995
		'ExpandFilm' => '44994',
996
		'ExpandFilterLens' => '44995',
997
		'ExpandScanner' => '44996',
998
		'ExpandFlashLamp' => '44997',
999
		'PixelFormat' => '48129',
1000
		'Transformation' => '48130',
1001
		'Uncompressed' => '48131',
1002
		'ImageType' => '48132',
1003
		'ImageWidth' => '48256',
1004
		'ImageHeight' => '48257',
1005
		'WidthResolution' => '48258',
1006
		'HeightResolution' => '48259',
1007
		'ImageOffset' => '48320',
1008
		'ImageByteCount' => '48321',
1009
		'AlphaOffset' => '48322',
1010
		'AlphaByteCount' => '48323',
1011
		'ImageDataDiscard' => '48324',
1012
		'AlphaDataDiscard' => '48325',
1013
		'OceScanjobDesc' => '50215',
1014
		'OceApplicationSelector' => '50216',
1015
		'OceIDNumber' => '50217',
1016
		'OceImageLogic' => '50218',
1017
		'Annotations' => '50255',
1018
		'PrintIM' => '50341',
1019
		'USPTOOriginalContentType' => '50560',
1020
		'DNGVersion' => '50706',
1021
		'DNGBackwardVersion' => '50707',
1022
		'UniqueCameraModel' => '50708',
1023
		'LocalizedCameraModel' => '50709',
1024
		'CFAPlaneColor' => '50710',
1025
		'CFALayout' => '50711',
1026
		'LinearizationTable' => '50712',
1027
		'BlackLevelRepeatDim' => '50713',
1028
		'BlackLevel' => '50714',
1029
		'BlackLevelDeltaH' => '50715',
1030
		'BlackLevelDeltaV' => '50716',
1031
		'WhiteLevel' => '50717',
1032
		'DefaultScale' => '50718',
1033
		'DefaultCropOrigin' => '50719',
1034
		'DefaultCropSize' => '50720',
1035
		'ColorMatrix1' => '50721',
1036
		'ColorMatrix2' => '50722',
1037
		'CameraCalibration1' => '50723',
1038
		'CameraCalibration2' => '50724',
1039
		'ReductionMatrix1' => '50725',
1040
		'ReductionMatrix2' => '50726',
1041
		'AnalogBalance' => '50727',
1042
		'AsShotNeutral' => '50728',
1043
		'AsShotWhiteXY' => '50729',
1044
		'BaselineExposure' => '50730',
1045
		'BaselineNoise' => '50731',
1046
		'BaselineSharpness' => '50732',
1047
		'BayerGreenSplit' => '50733',
1048
		'LinearResponseLimit' => '50734',
1049
		'CameraSerialNumber' => '50735',
1050
		'DNGLensInfo' => '50736',
1051
		'ChromaBlurRadius' => '50737',
1052
		'AntiAliasStrength' => '50738',
1053
		'ShadowScale' => '50739',
1054
		'SR2Private' => '50740',
1055
		'MakerNoteSafety' => '50741',
1056
		'RawImageSegmentation' => '50752',
1057
		'CalibrationIlluminant1' => '50778',
1058
		'CalibrationIlluminant2' => '50779',
1059
		'BestQualityScale' => '50780',
1060
		'RawDataUniqueID' => '50781',
1061
		'AliasLayerMetadata' => '50784',
1062
		'OriginalRawFileName' => '50827',
1063
		'OriginalRawFileData' => '50828',
1064
		'ActiveArea' => '50829',
1065
		'MaskedAreas' => '50830',
1066
		'AsShotICCProfile' => '50831',
1067
		'AsShotPreProfileMatrix' => '50832',
1068
		'CurrentICCProfile' => '50833',
1069
		'CurrentPreProfileMatrix' => '50834',
1070
		'ColorimetricReference' => '50879',
1071
		'PanasonicTitle' => '50898',
1072
		'PanasonicTitle2' => '50899',
1073
		'CameraCalibrationSig' => '50931',
1074
		'ProfileCalibrationSig' => '50932',
1075
		'ProfileIFD' => '50933',
1076
		'AsShotProfileName' => '50934',
1077
		'NoiseReductionApplied' => '50935',
1078
		'ProfileName' => '50936',
1079
		'ProfileHueSatMapDims' => '50937',
1080
		'ProfileHueSatMapData1' => '50938',
1081
		'ProfileHueSatMapData2' => '50939',
1082
		'ProfileToneCurve' => '50940',
1083
		'ProfileEmbedPolicy' => '50941',
1084
		'ProfileCopyright' => '50942',
1085
		'ForwardMatrix1' => '50964',
1086
		'ForwardMatrix2' => '50965',
1087
		'PreviewApplicationName' => '50966',
1088
		'PreviewApplicationVersion' => '50967',
1089
		'PreviewSettingsName' => '50968',
1090
		'PreviewSettingsDigest' => '50969',
1091
		'PreviewColorSpace' => '50970',
1092
		'PreviewDateTime' => '50971',
1093
		'RawImageDigest' => '50972',
1094
		'OriginalRawFileDigest' => '50973',
1095
		'SubTileBlockSize' => '50974',
1096
		'RowInterleaveFactor' => '50975',
1097
		'ProfileLookTableDims' => '50981',
1098
		'ProfileLookTableData' => '50982',
1099
		'OpcodeList1' => '51008',
1100
		'OpcodeList2' => '51009',
1101
		'OpcodeList3' => '51022',
1102
		'NoiseProfile' => '51041',
1103
		'Padding' => '59932',
1104
		'OffsetSchema' => '59933',
1105
		'OwnerName' => '65000',
1106
		'SerialNumber' => '65001',
1107
		'Lens' => '65002',
1108
		'KDC_IFD' => '65024',
1109
		'RawFile' => '65100',
1110
		'Converter' => '65101',
1111
		'WhiteBalance' => '65102',
1112
		'Exposure' => '65105',
1113
		'Shadows' => '65106',
1114
		'Brightness' => '65107',
1115
		'Contrast' => '65108',
1116
		'Saturation' => '65109',
1117
		'Sharpness' => '65110',
1118
		'Smoothness' => '65111',
1119
		'MoireFilter' => '65112',
1120
	);
1121
 
1122
	private $tableau_ids_tags_iptc = array('ApplicationRecordVersion' => '0',
1123
		'ObjectTypeReference' => '3',
1124
		'ObjectAttributeReference' => '4',
1125
		'ObjectName' => '5',
1126
		'EditStatus' => '7',
1127
		'EditorialUpdate' => '8',
1128
		'Urgency' => '16',
1129
		'SubjectReference' => '18',
1130
		'Category' => '21',
1131
		'SupplementalCategories' => '32',
1132
		'FixtureIdentifier' => '34',
1133
		'Keywords' => '37',
1134
		'ContentLocationCode' => '38',
1135
		'ContentLocationName' => '39',
1136
		'ReleaseDate' => '48',
1137
		'ReleaseTime' => '53',
1138
		'ExpirationDate' => '55',
1139
		'ExpirationTime' => '56',
1140
		'SpecialInstructions' => '64',
1141
		'ActionAdvised' => '66',
1142
		'ReferenceService' => '69',
1143
		'ReferenceDate' => '71',
1144
		'ReferenceNumber' => '80',
1145
		'DateCreated' => '85',
1146
		'TimeCreated' => '96',
1147
		'DigitalCreationDate' => '98',
1148
		'DigitalCreationTime' => '99',
1149
		'OriginatingProgram' => '101',
1150
		'ProgramVersion' => '112',
1151
		'ObjectCycle' => '117',
1152
		'By-line' => '128',
1153
		'By-lineTitle' => '133',
1154
		'City' => '144',
1155
		'Sub-location' => '146',
1156
		'Province-State' => '149',
1157
		'Country-PrimaryLocationCode' => '256',
1158
		'Country-PrimaryLocationName' => '257',
1159
		'OriginalTransmissionReference' => '259',
1160
		'Headline' => '261',
1161
		'Credit' => '272',
1162
		'Source' => '277',
1163
		'CopyrightNotice' => '278',
1164
		'Contact' => '280',
1165
		'Caption-Abstract' => '288',
1166
		'LocalCaption' => '289',
1167
		'Writer-Editor' => '290',
1168
		'RasterizedCaption' => '293',
1169
		'ImageType' => '304',
1170
		'ImageOrientation' => '305',
1171
		'LanguageIdentifier' => '309',
1172
		'AudioType' => '336',
1173
		'AudioSamplingRate' => '337',
1174
		'AudioSamplingResolution' => '338',
1175
		'AudioDuration' => '339',
1176
		'AudioOutcue' => '340',
1177
		'JobID' => '388',
1178
		'MasterDocumentID' => '389',
1179
		'ShortDocumentID' => '390',
1180
		'UniqueDocumentID' => '391',
1181
		'OwnerID' => '392',
1182
		'ObjectPreviewFileFormat' => '512',
1183
		'ObjectPreviewFileVersion' => '513',
1184
		'ObjectPreviewData' => '514',
1185
		'Prefs' => '545',
1186
		'ClassifyState' => '549',
1187
		'SimilarityIndex' => '552',
1188
		'DocumentNotes' => '560',
1189
		'DocumentHistory' => '561',
1190
		'ExifCameraInfo' => '562',
1191
		'CatalogSets' => '597',
1192
	);
1193
}