Rev 1200 | Go to most recent revision | Blame | Last modification | View Log | RSS feed
<?php
// declare(encoding='UTF-8');
/**
* Script de migration des Images de la version 1 de la base de données du CEL à la v2.
* Utilisation : /opt/lampp/bin/php cli.php MigrationImages
*
* @category php 5.2
* @package Cel/Scripts
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
class MigrationImages {
const dry_run = false;
const truncate = true; //Doit on vider les tables de destination ?
const separateur_champs_metadonnees = ';';
const separateur_valeurs_metadonnees = ':';
private $bdd = null;
private $script = null;
public static $bdd_cel_migration;
public static $bdd_utilisateurs;
private $cle_id_metadonnees = array();
private $tableau_utilisateurs = array();
private $tableau_observations = array();
private $tableau_mots_cles = array();
/** Tableau associatif permettant de stocker l'avancement dans une boucle.
* La clé est un md5 du message à afficher au démarrage de la boucle.
* @var array
*/
private static $avancement = array();
private $tableau_nouveau_ancien = array(
'id_image' => 'ci_id_image',
'ordre' =>'ci_ordre',
'ce_utilisateur' => 'traiterIdentifiantUtilisateur',
'prenom_utilisateur' => 'traiterPrenomUtilisateur',
'nom_utilisateur' => 'traiterNomUtilisateur',
'courriel_utilisateur' => 'ci_ce_utilisateur',
'hauteur' => 'ci_meta_height',
'largeur' => 'ci_meta_width',
'appareil_fabriquant' => 'ci_meta_make',
'appareil_modele' => 'ci_meta_model',
'date_prise_de_vue' => 'ci_meta_date_time',
'note_qualite' => 'traiterNoteImage',
'mots_cles_texte' => 'ci_meta_mots_cles',
'commentaire' => 'ci_meta_comment',
'nom_original' => 'ci_nom_original',
'md5' => 'ci_md5',
'meta_exif' => 'traiterExif',
'meta_iptc' => 'traiterIptc',
'meta_xmp' => 'traiterXmp',
'meta_makernote' => 'traiterMakernote',
'date_modification' => 'ci_meta_date',
'date_creation' => 'ci_meta_date_ajout'
);
private $champs_exifs_non_gardes = array(
'ci_meta_x_resolution',
'ci_meta_y_resolution',
'ci_meta_gps',
'ci_meta_user_comment',
'ci_meta_exif_exposure_time',
'ci_meta_exif_f_number',
'ci_meta_exif_exif_version',
'ci_meta_exif_compressed_bits_per_pixel',
'ci_meta_exif_shutter_speed_value',
'ci_meta_exif_aperture_value',
'ci_meta_exif_exposure_bias_value',
'ci_meta_exif_max_aperture_value',
'ci_meta_exif_metering_mode',
'ci_meta_exif_light_source',
'ci_meta_exif_flash',
'ci_meta_exif_focal_length',
'ci_meta_exif_flash_pix_version',
'ci_meta_exif_color_space',
'ci_meta_exif_interoperability_offset',
'ci_meta_exif_focal_plane_x_resolution',
'ci_meta_exif_focal_plane_y_resolution',
'ci_meta_exif_focal_plane_resolution_unit',
'ci_meta_exif_sensing_method',
'ci_meta_exif_file_source',
'ci_meta_exif_custom_rendered',
'ci_meta_exif_exposure_mode',
'ci_meta_exif_white_balance',
'ci_meta_exif_digital_zoom_ratio',
'ci_meta_exif_scene_capture_type',
'ci_meta_exif_gain_control',
'ci_meta_exif_contrast',
'ci_meta_exif_saturation',
'ci_meta_exif_sharpness',
'ci_meta_exif_subject_distance_range'
);
private $champs_iptc_non_gardes = array(
'ci_meta_iptc_category',
'ci_meta_iptc_by_line',
'ci_meta_iptc_by_line_title',
'ci_meta_iptc_city',
'ci_meta_iptc_sub_location',
'ci_meta_iptc_province_state',
'ci_meta_iptc_country_primary_location_code',
'ci_meta_iptc_country_name',
'ci_meta_iptc_headline',
'ci_meta_iptc_credit',
'ci_meta_iptc_copyright_notice',
'ci_meta_iptc_contact'
);
private $champs_divers_non_gardes = array(
'ci_publiable_eflore',
'ci_meta_mots_cles'
);
private $ids_tags_exif = array(
'InteropIndex' => array('id' => '1', 'tag' => 'InteropIndex', 'categorie' => 'InteropIFD'),
'InteropVersion' => array('id' => '2', 'tag' => 'InteropVersion', 'categorie' => 'InteropIFD'),
'ProcessingSoftware' => array('id' => '11', 'tag' => 'ProcessingSoftware', 'categorie' => 'IFD0'),
'SubfileType' => array('id' => '254', 'tag' => 'SubfileType', 'categorie' => 'IFD0'),
'OldSubfileType' => array('id' => '255', 'tag' => 'OldSubfileType', 'categorie' => 'IFD0'),
'ImageWidth' => array('id' => '256', 'tag' => 'ImageWidth', 'categorie' => 'IFD0'),
'ImageLength' => array('id' => '257', 'tag' => 'ImageHeight', 'categorie' => 'IFD0'),
'BitsPerSample' => array('id' => '258', 'tag' => 'BitsPerSample', 'categorie' => 'IFD0'),
'Compression' => array('id' => '259', 'tag' => 'Compression', 'categorie' => 'IFD0'),
'PhotometricInterpretation' => array('id' => '262', 'tag' => 'PhotometricInterpretation', 'categorie' => 'IFD0'),
'Thresholding' => array('id' => '263', 'tag' => 'Thresholding', 'categorie' => 'IFD0'),
'CellWidth' => array('id' => '264', 'tag' => 'CellWidth', 'categorie' => 'IFD0'),
'CellLength' => array('id' => '265', 'tag' => 'CellLength', 'categorie' => 'IFD0'),
'FillOrder' => array('id' => '266', 'tag' => 'FillOrder', 'categorie' => 'IFD0'),
'DocumentName' => array('id' => '269', 'tag' => 'DocumentName', 'categorie' => 'IFD0'),
'ImageDescription' => array('id' => '270', 'tag' => 'ImageDescription', 'categorie' => 'IFD0'),
'Make' => array('id' => '271', 'tag' => 'Make', 'categorie' => 'IFD0'),
'Model' => array('id' => '272', 'tag' => 'Model', 'categorie' => 'IFD0'),
'StripOffsets' => array('id' => '273', 'tag' => 'StripOffsets', 'categorie' => 'IFD0'),
'Orientation' => array('id' => '274', 'tag' => 'Orientation', 'categorie' => 'IFD0'),
'SamplesPerPixel' => array('id' => '277', 'tag' => 'SamplesPerPixel', 'categorie' => 'IFD0'),
'RowsPerStrip' => array('id' => '278', 'tag' => 'RowsPerStrip', 'categorie' => 'IFD0'),
'StripByteCounts' => array('id' => '279', 'tag' => 'StripByteCounts', 'categorie' => 'IFD0'),
'MinSampleValue' => array('id' => '280', 'tag' => 'MinSampleValue', 'categorie' => 'IFD0'),
'MaxSampleValue' => array('id' => '281', 'tag' => 'MaxSampleValue', 'categorie' => 'IFD0'),
'XResolution' => array('id' => '282', 'tag' => 'XResolution', 'categorie' => 'IFD0'),
'YResolution' => array('id' => '283', 'tag' => 'YResolution', 'categorie' => 'IFD0'),
'PlanarConfiguration' => array('id' => '284', 'tag' => 'PlanarConfiguration', 'categorie' => 'IFD0'),
'PageName' => array('id' => '285', 'tag' => 'PageName', 'categorie' => 'IFD0'),
'XPosition' => array('id' => '286', 'tag' => 'XPosition', 'categorie' => 'IFD0'),
'YPosition' => array('id' => '287', 'tag' => 'YPosition', 'categorie' => 'IFD0'),
'FreeOffsets' => array('id' => '288', 'tag' => 'FreeOffsets', 'categorie' => 'Unknown'),
'FreeByteCounts' => array('id' => '289', 'tag' => 'FreeByteCounts', 'categorie' => 'Unknown'),
'GrayResponseUnit' => array('id' => '290', 'tag' => 'GrayResponseUnit', 'categorie' => 'IFD0'),
'GrayResponseCurve' => array('id' => '291', 'tag' => 'GrayResponseCurve', 'categorie' => 'Unknown'),
'T4Options' => array('id' => '292', 'tag' => 'T4Options', 'categorie' => 'Unknown'),
'T6Options' => array('id' => '293', 'tag' => 'T6Options', 'categorie' => 'Unknown'),
'ResolutionUnit' => array('id' => '296', 'tag' => 'ResolutionUnit', 'categorie' => 'IFD0'),
'PageNumber' => array('id' => '297', 'tag' => 'PageNumber', 'categorie' => 'IFD0'),
'ColorResponseUnit' => array('id' => '300', 'tag' => 'ColorResponseUnit', 'categorie' => 'Unknown'),
'TransferFunction' => array('id' => '301', 'tag' => 'TransferFunction', 'categorie' => 'IFD0'),
'Software' => array('id' => '305', 'tag' => 'Software', 'categorie' => 'IFD0'),
'ModifyDate' => array('id' => '306', 'tag' => 'ModifyDate', 'categorie' => 'IFD0'),
'DateTime' => array('id' => '306', 'tag' => 'ModifyDate', 'categorie' => 'IFD0'),
'Artist' => array('id' => '315', 'tag' => 'Artist', 'categorie' => 'IFD0'),
'HostComputer' => array('id' => '316', 'tag' => 'HostComputer', 'categorie' => 'IFD0'),
'Predictor' => array('id' => '317', 'tag' => 'Predictor', 'categorie' => 'IFD0'),
'WhitePoint' => array('id' => '318', 'tag' => 'WhitePoint', 'categorie' => 'IFD0'),
'PrimaryChromaticities' => array('id' => '319', 'tag' => 'PrimaryChromaticities', 'categorie' => 'IFD0'),
'ColorMap' => array('id' => '320', 'tag' => 'ColorMap', 'categorie' => 'Unknown'),
'HalftoneHints' => array('id' => '321', 'tag' => 'HalftoneHints', 'categorie' => 'IFD0'),
'TileWidth' => array('id' => '322', 'tag' => 'TileWidth', 'categorie' => 'IFD0'),
'TileLength' => array('id' => '323', 'tag' => 'TileLength', 'categorie' => 'IFD0'),
'TileOffsets' => array('id' => '324', 'tag' => 'TileOffsets', 'categorie' => 'Unknown'),
'TileByteCounts' => array('id' => '325', 'tag' => 'TileByteCounts', 'categorie' => 'Unknown'),
'BadFaxLines' => array('id' => '326', 'tag' => 'BadFaxLines', 'categorie' => 'Unknown'),
'CleanFaxData' => array('id' => '327', 'tag' => 'CleanFaxData', 'categorie' => 'Unknown'),
'ConsecutiveBadFaxLines' => array('id' => '328', 'tag' => 'ConsecutiveBadFaxLines', 'categorie' => 'Unknown'),
'SubIFD' => array('id' => '330', 'tag' => 'SubIFD', 'categorie' => 'Unknown'),
'InkSet' => array('id' => '332', 'tag' => 'InkSet', 'categorie' => 'IFD0'),
'InkNames' => array('id' => '333', 'tag' => 'InkNames', 'categorie' => 'Unknown'),
'NumberofInks' => array('id' => '334', 'tag' => 'NumberofInks', 'categorie' => 'Unknown'),
'DotRange' => array('id' => '336', 'tag' => 'DotRange', 'categorie' => 'IFD0'),
'TargetPrinter' => array('id' => '337', 'tag' => 'TargetPrinter', 'categorie' => 'Unknown'),
'ExtraSamples' => array('id' => '338', 'tag' => 'ExtraSamples', 'categorie' => 'Unknown'),
'SampleFormat' => array('id' => '339', 'tag' => 'SampleFormat', 'categorie' => 'Unknown'),
'SMinSampleValue' => array('id' => '340', 'tag' => 'SMinSampleValue', 'categorie' => 'Unknown'),
'SMaxSampleValue' => array('id' => '341', 'tag' => 'SMaxSampleValue', 'categorie' => 'Unknown'),
'TransferRange' => array('id' => '342', 'tag' => 'TransferRange', 'categorie' => 'Unknown'),
'ClipPath' => array('id' => '343', 'tag' => 'ClipPath', 'categorie' => 'Unknown'),
'XClipPathUnits' => array('id' => '344', 'tag' => 'XClipPathUnits', 'categorie' => 'Unknown'),
'YClipPathUnits' => array('id' => '345', 'tag' => 'YClipPathUnits', 'categorie' => 'Unknown'),
'Indexed' => array('id' => '346', 'tag' => 'Indexed', 'categorie' => 'Unknown'),
'JPEGTables' => array('id' => '347', 'tag' => 'JPEGTables', 'categorie' => 'Unknown'),
'OPIProxy' => array('id' => '351', 'tag' => 'OPIProxy', 'categorie' => 'Unknown'),
'GlobalParametersIFD' => array('id' => '400', 'tag' => 'GlobalParametersIFD', 'categorie' => 'Unknown'),
'ProfileType' => array('id' => '401', 'tag' => 'ProfileType', 'categorie' => 'Unknown'),
'FaxProfile' => array('id' => '402', 'tag' => 'FaxProfile', 'categorie' => 'Unknown'),
'CodingMethods' => array('id' => '403', 'tag' => 'CodingMethods', 'categorie' => 'Unknown'),
'VersionYear' => array('id' => '404', 'tag' => 'VersionYear', 'categorie' => 'Unknown'),
'ModeNumber' => array('id' => '405', 'tag' => 'ModeNumber', 'categorie' => 'Unknown'),
'Decode' => array('id' => '433', 'tag' => 'Decode', 'categorie' => 'Unknown'),
'DefaultImageColor' => array('id' => '434', 'tag' => 'DefaultImageColor', 'categorie' => 'Unknown'),
'T82Options' => array('id' => '435', 'tag' => 'T82Options', 'categorie' => 'Unknown'),
'JPEGProc' => array('id' => '512', 'tag' => 'JPEGProc', 'categorie' => 'Unknown'),
'ThumbnailOffset' => array('id' => '513', 'tag' => 'ThumbnailOffset', 'categorie' => 'IFD1'),
'ThumbnailLength' => array('id' => '514', 'tag' => 'ThumbnailLength', 'categorie' => 'IFD1'),
'JPEGRestartInterval' => array('id' => '515', 'tag' => 'JPEGRestartInterval', 'categorie' => 'Unknown'),
'JPEGLosslessPredictors' => array('id' => '517', 'tag' => 'JPEGLosslessPredictors', 'categorie' => 'Unknown'),
'JPEGPointTransforms' => array('id' => '518', 'tag' => 'JPEGPointTransforms', 'categorie' => 'Unknown'),
'JPEGQTables' => array('id' => '519', 'tag' => 'JPEGQTables', 'categorie' => 'Unknown'),
'JPEGDCTables' => array('id' => '520', 'tag' => 'JPEGDCTables', 'categorie' => 'Unknown'),
'JPEGACTables' => array('id' => '521', 'tag' => 'JPEGACTables', 'categorie' => 'Unknown'),
'YCbCrCoefficients' => array('id' => '529', 'tag' => 'YCbCrCoefficients', 'categorie' => 'IFD0'),
'YCbCrSubSampling' => array('id' => '530', 'tag' => 'YCbCrSubSampling', 'categorie' => 'IFD0'),
'YCbCrPositioning' => array('id' => '531', 'tag' => 'YCbCrPositioning', 'categorie' => 'IFD0'),
'ReferenceBlackWhite' => array('id' => '532', 'tag' => 'ReferenceBlackWhite', 'categorie' => 'IFD0'),
'StripRowCounts' => array('id' => '559', 'tag' => 'StripRowCounts', 'categorie' => 'Unknown'),
'ApplicationNotes' => array('id' => '700', 'tag' => 'ApplicationNotes', 'categorie' => 'ExifIFD'),
'USPTOMiscellaneous' => array('id' => '999', 'tag' => 'USPTOMiscellaneous', 'categorie' => 'Unknown'),
'RelatedImageFileFormat' => array('id' => '4096', 'tag' => 'RelatedImageFileFormat', 'categorie' => 'InteropIFD'),
'RelatedImageWidth' => array('id' => '4097', 'tag' => 'RelatedImageWidth', 'categorie' => 'InteropIFD'),
'RelatedImageHeight' => array('id' => '4098', 'tag' => 'RelatedImageHeight', 'categorie' => 'InteropIFD'),
'RelatedImageLength' => array('id' => '4098', 'tag' => 'RelatedImageHeight', 'categorie' => 'InteropIFD'),
'Rating' => array('id' => '18246', 'tag' => 'Rating', 'categorie' => 'IFD0'),
'XP_DIP_XML' => array('id' => '18247', 'tag' => 'XP_DIP_XML', 'categorie' => 'Unknown'),
'StitchInfo' => array('id' => '18248', 'tag' => 'StitchInfo', 'categorie' => 'Unknown'),
'RatingPercent' => array('id' => '18249', 'tag' => 'RatingPercent', 'categorie' => 'IFD0'),
'ImageID' => array('id' => '32781', 'tag' => 'ImageID', 'categorie' => 'Unknown'),
'WangTag1' => array('id' => '32931', 'tag' => 'WangTag1', 'categorie' => 'Unknown'),
'WangAnnotation' => array('id' => '32932', 'tag' => 'WangAnnotation', 'categorie' => 'Unknown'),
'WangTag3' => array('id' => '32933', 'tag' => 'WangTag3', 'categorie' => 'Unknown'),
'WangTag4' => array('id' => '32934', 'tag' => 'WangTag4', 'categorie' => 'Unknown'),
'Matteing' => array('id' => '32995', 'tag' => 'Matteing', 'categorie' => 'Unknown'),
'DataType' => array('id' => '32996', 'tag' => 'DataType', 'categorie' => 'Unknown'),
'ImageDepth' => array('id' => '32997', 'tag' => 'ImageDepth', 'categorie' => 'Unknown'),
'TileDepth' => array('id' => '32998', 'tag' => 'TileDepth', 'categorie' => 'Unknown'),
'Model2' => array('id' => '33405', 'tag' => 'Model2', 'categorie' => 'Unknown'),
'CFARepeatPatternDim' => array('id' => '33421', 'tag' => 'CFARepeatPatternDim', 'categorie' => 'Unknown'),
'CFAPattern2' => array('id' => '33422', 'tag' => 'CFAPattern2', 'categorie' => 'Unknown'),
'BatteryLevel' => array('id' => '33423', 'tag' => 'BatteryLevel', 'categorie' => 'Unknown'),
'KodakIFD' => array('id' => '33424', 'tag' => 'KodakIFD', 'categorie' => 'Unknown'),
'Copyright' => array('id' => '33432', 'tag' => 'Copyright', 'categorie' => 'IFD0'),
'ExposureTime' => array('id' => '33434', 'tag' => 'ExposureTime', 'categorie' => 'ExifIFD'),
'FNumber' => array('id' => '33437', 'tag' => 'FNumber', 'categorie' => 'ExifIFD'),
'MDFileTag' => array('id' => '33445', 'tag' => 'MDFileTag', 'categorie' => 'Unknown'),
'MDScalePixel' => array('id' => '33446', 'tag' => 'MDScalePixel', 'categorie' => 'Unknown'),
'MDColorTable' => array('id' => '33447', 'tag' => 'MDColorTable', 'categorie' => 'Unknown'),
'MDLabName' => array('id' => '33448', 'tag' => 'MDLabName', 'categorie' => 'Unknown'),
'MDSampleInfo' => array('id' => '33449', 'tag' => 'MDSampleInfo', 'categorie' => 'Unknown'),
'MDPrepDate' => array('id' => '33450', 'tag' => 'MDPrepDate', 'categorie' => 'Unknown'),
'MDPrepTime' => array('id' => '33451', 'tag' => 'MDPrepTime', 'categorie' => 'Unknown'),
'MDFileUnits' => array('id' => '33452', 'tag' => 'MDFileUnits', 'categorie' => 'Unknown'),
'PixelScale' => array('id' => '33550', 'tag' => 'PixelScale', 'categorie' => 'Unknown'),
'AdventScale' => array('id' => '33589', 'tag' => 'AdventScale', 'categorie' => 'Unknown'),
'AdventRevision' => array('id' => '33590', 'tag' => 'AdventRevision', 'categorie' => 'Unknown'),
'UIC1Tag' => array('id' => '33628', 'tag' => 'UIC1Tag', 'categorie' => 'Unknown'),
'UIC2Tag' => array('id' => '33629', 'tag' => 'UIC2Tag', 'categorie' => 'Unknown'),
'UIC3Tag' => array('id' => '33630', 'tag' => 'UIC3Tag', 'categorie' => 'Unknown'),
'UIC4Tag' => array('id' => '33631', 'tag' => 'UIC4Tag', 'categorie' => 'Unknown'),
'IPTC-NAA' => array('id' => '33723', 'tag' => 'IPTC-NAA', 'categorie' => 'IFD0'),
'IntergraphPacketData' => array('id' => '33918', 'tag' => 'IntergraphPacketData', 'categorie' => 'Unknown'),
'IntergraphFlagRegisters' => array('id' => '33919', 'tag' => 'IntergraphFlagRegisters', 'categorie' => 'Unknown'),
'IntergraphMatrix' => array('id' => '33920', 'tag' => 'IntergraphMatrix', 'categorie' => 'Unknown'),
'INGRReserved' => array('id' => '33921', 'tag' => 'INGRReserved', 'categorie' => 'Unknown'),
'ModelTiePoint' => array('id' => '33922', 'tag' => 'ModelTiePoint', 'categorie' => 'Unknown'),
'Site' => array('id' => '34016', 'tag' => 'Site', 'categorie' => 'Unknown'),
'ColorSequence' => array('id' => '34017', 'tag' => 'ColorSequence', 'categorie' => 'Unknown'),
'IT8Header' => array('id' => '34018', 'tag' => 'IT8Header', 'categorie' => 'Unknown'),
'RasterPadding' => array('id' => '34019', 'tag' => 'RasterPadding', 'categorie' => 'Unknown'),
'BitsPerRunLength' => array('id' => '34020', 'tag' => 'BitsPerRunLength', 'categorie' => 'Unknown'),
'BitsPerExtendedRunLength' => array('id' => '34021', 'tag' => 'BitsPerExtendedRunLength', 'categorie' => 'Unknown'),
'ColorTable' => array('id' => '34022', 'tag' => 'ColorTable', 'categorie' => 'Unknown'),
'ImageColorIndicator' => array('id' => '34023', 'tag' => 'ImageColorIndicator', 'categorie' => 'Unknown'),
'BackgroundColorIndicator' => array('id' => '34024', 'tag' => 'BackgroundColorIndicator', 'categorie' => 'Unknown'),
'ImageColorValue' => array('id' => '34025', 'tag' => 'ImageColorValue', 'categorie' => 'Unknown'),
'BackgroundColorValue' => array('id' => '34026', 'tag' => 'BackgroundColorValue', 'categorie' => 'Unknown'),
'PixelIntensityRange' => array('id' => '34027', 'tag' => 'PixelIntensityRange', 'categorie' => 'Unknown'),
'TransparencyIndicator' => array('id' => '34028', 'tag' => 'TransparencyIndicator', 'categorie' => 'Unknown'),
'ColorCharacterization' => array('id' => '34029', 'tag' => 'ColorCharacterization', 'categorie' => 'Unknown'),
'HCUsage' => array('id' => '34030', 'tag' => 'HCUsage', 'categorie' => 'Unknown'),
'TrapIndicator' => array('id' => '34031', 'tag' => 'TrapIndicator', 'categorie' => 'Unknown'),
'CMYKEquivalent' => array('id' => '34032', 'tag' => 'CMYKEquivalent', 'categorie' => 'Unknown'),
'SEMInfo' => array('id' => '34118', 'tag' => 'SEMInfo', 'categorie' => 'IFD0'),
'AFCP_IPTC' => array('id' => '34152', 'tag' => 'AFCP_IPTC', 'categorie' => 'Unknown'),
'PixelMagicJBIGOptions' => array('id' => '34232', 'tag' => 'PixelMagicJBIGOptions', 'categorie' => 'Unknown'),
'ModelTransform' => array('id' => '34264', 'tag' => 'ModelTransform', 'categorie' => 'Unknown'),
'WB_GRGBLevels' => array('id' => '34306', 'tag' => 'WB_GRGBLevels', 'categorie' => 'Unknown'),
'LeafData' => array('id' => '34310', 'tag' => 'LeafData', 'categorie' => 'Unknown'),
'PhotoshopSettings' => array('id' => '34377', 'tag' => 'PhotoshopSettings', 'categorie' => 'Unknown'),
'ExifIFDPointer' => array('id' => '34665', 'tag' => 'ExifOffset', 'categorie' => 'Unknown'),
'ICC_Profile' => array('id' => '34675', 'tag' => 'ICC_Profile', 'categorie' => 'Unknown'),
'TIFF_FXExtensions' => array('id' => '34687', 'tag' => 'TIFF_FXExtensions', 'categorie' => 'Unknown'),
'MultiProfiles' => array('id' => '34688', 'tag' => 'MultiProfiles', 'categorie' => 'Unknown'),
'SharedData' => array('id' => '34689', 'tag' => 'SharedData', 'categorie' => 'Unknown'),
'T88Options' => array('id' => '34690', 'tag' => 'T88Options', 'categorie' => 'Unknown'),
'ImageLayer' => array('id' => '34732', 'tag' => 'ImageLayer', 'categorie' => 'Unknown'),
'GeoTiffDirectory' => array('id' => '34735', 'tag' => 'GeoTiffDirectory', 'categorie' => 'Unknown'),
'GeoTiffDoubleParams' => array('id' => '34736', 'tag' => 'GeoTiffDoubleParams', 'categorie' => 'Unknown'),
'GeoTiffAsciiParams' => array('id' => '34737', 'tag' => 'GeoTiffAsciiParams', 'categorie' => 'Unknown'),
'ExposureProgram' => array('id' => '34850', 'tag' => 'ExposureProgram', 'categorie' => 'ExifIFD'),
'SpectralSensitivity' => array('id' => '34852', 'tag' => 'SpectralSensitivity', 'categorie' => 'ExifIFD'),
'GPSIFDPointer' => array('id' => '34853', 'tag' => 'GPSInfo', 'categorie' => 'Unknown'),
'ISO' => array('id' => '34855', 'tag' => 'ISO', 'categorie' => 'ExifIFD'),
'ISOSpeedRatings' => array('id' => '34855', 'tag' => 'ISO', 'categorie' => 'ExifIFD'),
'PhotographicSensitivity' => array('id' => '34855', 'tag' => 'ISO', 'categorie' => 'ExifIFD'),
'Opto-ElectricConvFactor' => array('id' => '34856', 'tag' => 'Opto-ElectricConvFactor', 'categorie' => 'Unknown'),
'OECF' => array('id' => '34856', 'tag' => 'Opto-ElectricConvFactor', 'categorie' => 'Unknown'),
'Interlace' => array('id' => '34857', 'tag' => 'Interlace', 'categorie' => 'Unknown'),
'TimeZoneOffset' => array('id' => '34858', 'tag' => 'TimeZoneOffset', 'categorie' => 'ExifIFD'),
'SelfTimerMode' => array('id' => '34859', 'tag' => 'SelfTimerMode', 'categorie' => 'ExifIFD'),
'SensitivityType' => array('id' => '34864', 'tag' => 'SensitivityType', 'categorie' => 'ExifIFD'),
'StandardOutputSensitivity' => array('id' => '34865', 'tag' => 'StandardOutputSensitivity', 'categorie' => 'ExifIFD'),
'RecommendedExposureIndex' => array('id' => '34866', 'tag' => 'RecommendedExposureIndex', 'categorie' => 'ExifIFD'),
'ISOSpeed' => array('id' => '34867', 'tag' => 'ISOSpeed', 'categorie' => 'ExifIFD'),
'ISOSpeedLatitudeyyy' => array('id' => '34868', 'tag' => 'ISOSpeedLatitudeyyy', 'categorie' => 'ExifIFD'),
'ISOSpeedLatitudezzz' => array('id' => '34869', 'tag' => 'ISOSpeedLatitudezzz', 'categorie' => 'ExifIFD'),
'FaxRecvParams' => array('id' => '34908', 'tag' => 'FaxRecvParams', 'categorie' => 'Unknown'),
'FaxSubAddress' => array('id' => '34909', 'tag' => 'FaxSubAddress', 'categorie' => 'Unknown'),
'FaxRecvTime' => array('id' => '34910', 'tag' => 'FaxRecvTime', 'categorie' => 'Unknown'),
'LeafSubIFD' => array('id' => '34954', 'tag' => 'LeafSubIFD', 'categorie' => 'Unknown'),
'ExifVersion' => array('id' => '36864', 'tag' => 'ExifVersion', 'categorie' => 'ExifIFD'),
'DateTimeOriginal' => array('id' => '36867', 'tag' => 'DateTimeOriginal', 'categorie' => 'ExifIFD'),
'CreateDate' => array('id' => '36868', 'tag' => 'CreateDate', 'categorie' => 'ExifIFD'),
'DateTimeDigitized' => array('id' => '36868', 'tag' => 'CreateDate', 'categorie' => 'ExifIFD'),
'ComponentsConfiguration' => array('id' => '37121', 'tag' => 'ComponentsConfiguration', 'categorie' => 'ExifIFD'),
'CompressedBitsPerPixel' => array('id' => '37122', 'tag' => 'CompressedBitsPerPixel', 'categorie' => 'ExifIFD'),
'ShutterSpeedValue' => array('id' => '37377', 'tag' => 'ShutterSpeedValue', 'categorie' => 'ExifIFD'),
'ApertureValue' => array('id' => '37378', 'tag' => 'ApertureValue', 'categorie' => 'ExifIFD'),
'BrightnessValue' => array('id' => '37379', 'tag' => 'BrightnessValue', 'categorie' => 'ExifIFD'),
'ExposureBiasValue' => array('id' => '37380', 'tag' => 'ExposureCompensation', 'categorie' => 'ExifIFD'),
'MaxApertureValue' => array('id' => '37381', 'tag' => 'MaxApertureValue', 'categorie' => 'ExifIFD'),
'SubjectDistance' => array('id' => '37382', 'tag' => 'SubjectDistance', 'categorie' => 'ExifIFD'),
'MeteringMode' => array('id' => '37383', 'tag' => 'MeteringMode', 'categorie' => 'ExifIFD'),
'LightSource' => array('id' => '37384', 'tag' => 'LightSource', 'categorie' => 'ExifIFD'),
'Flash' => array('id' => '37385', 'tag' => 'Flash', 'categorie' => 'ExifIFD'),
'FocalLength' => array('id' => '37386', 'tag' => 'FocalLength', 'categorie' => 'ExifIFD'),
'FlashEnergy' => array('id' => '37387', 'tag' => 'FlashEnergy', 'categorie' => 'Unknown'),
'SpatialFrequencyResponse' => array('id' => '37388', 'tag' => 'SpatialFrequencyResponse', 'categorie' => 'Unknown'),
'Noise' => array('id' => '37389', 'tag' => 'Noise', 'categorie' => 'Unknown'),
'FocalPlaneXResolution' => array('id' => '37390', 'tag' => 'FocalPlaneXResolution', 'categorie' => 'Unknown'),
'FocalPlaneYResolution' => array('id' => '37391', 'tag' => 'FocalPlaneYResolution', 'categorie' => 'Unknown'),
'FocalPlaneResolutionUnit' => array('id' => '37392', 'tag' => 'FocalPlaneResolutionUnit', 'categorie' => 'Unknown'),
'ImageNumber' => array('id' => '37393', 'tag' => 'ImageNumber', 'categorie' => 'ExifIFD'),
'SecurityClassification' => array('id' => '37394', 'tag' => 'SecurityClassification', 'categorie' => 'ExifIFD'),
'ImageHistory' => array('id' => '37395', 'tag' => 'ImageHistory', 'categorie' => 'ExifIFD'),
'SubjectArea' => array('id' => '37396', 'tag' => 'SubjectArea', 'categorie' => 'ExifIFD'),
'ExposureIndex' => array('id' => '37397', 'tag' => 'ExposureIndex', 'categorie' => 'Unknown'),
'TIFF-EPStandardID' => array('id' => '37398', 'tag' => 'TIFF-EPStandardID', 'categorie' => 'Unknown'),
'SensingMethod' => array('id' => '37399', 'tag' => 'SensingMethod', 'categorie' => 'Unknown'),
'CIP3DataFile' => array('id' => '37434', 'tag' => 'CIP3DataFile', 'categorie' => 'Unknown'),
'CIP3Sheet' => array('id' => '37435', 'tag' => 'CIP3Sheet', 'categorie' => 'Unknown'),
'CIP3Side' => array('id' => '37436', 'tag' => 'CIP3Side', 'categorie' => 'Unknown'),
'StoNits' => array('id' => '37439', 'tag' => 'StoNits', 'categorie' => 'Unknown'),
'MakerNote' => array('id' => '37500', 'tag' => 'MakerNote', 'categorie' => 'ExifIFD'),
'UserComment' => array('id' => '37510', 'tag' => 'UserComment', 'categorie' => 'ExifIFD'),
'SubSecTime' => array('id' => '37520', 'tag' => 'SubSecTime', 'categorie' => 'ExifIFD'),
'SubSecTimeOriginal' => array('id' => '37521', 'tag' => 'SubSecTimeOriginal', 'categorie' => 'ExifIFD'),
'SubSecTimeDigitized' => array('id' => '37522', 'tag' => 'SubSecTimeDigitized', 'categorie' => 'ExifIFD'),
'MSDocumentText' => array('id' => '37679', 'tag' => 'MSDocumentText', 'categorie' => 'Unknown'),
'MSPropertySetStorage' => array('id' => '37680', 'tag' => 'MSPropertySetStorage', 'categorie' => 'Unknown'),
'MSDocumentTextPosition' => array('id' => '37681', 'tag' => 'MSDocumentTextPosition', 'categorie' => 'Unknown'),
'ImageSourceData' => array('id' => '37724', 'tag' => 'ImageSourceData', 'categorie' => 'IFD0'),
'XPTitle' => array('id' => '40091', 'tag' => 'XPTitle', 'categorie' => 'IFD0'),
'XPComment' => array('id' => '40092', 'tag' => 'XPComment', 'categorie' => 'IFD0'),
'XPAuthor' => array('id' => '40093', 'tag' => 'XPAuthor', 'categorie' => 'IFD0'),
'XPKeywords' => array('id' => '40094', 'tag' => 'XPKeywords', 'categorie' => 'IFD0'),
'XPSubject' => array('id' => '40095', 'tag' => 'XPSubject', 'categorie' => 'IFD0'),
'FlashPixVersion' => array('id' => '40960', 'tag' => 'FlashpixVersion', 'categorie' => 'ExifIFD'),
'ColorSpace' => array('id' => '40961', 'tag' => 'ColorSpace', 'categorie' => 'ExifIFD'),
'ExifImageWidth' => array('id' => '40962', 'tag' => 'ExifImageWidth', 'categorie' => 'ExifIFD'),
'PixelXDimension' => array('id' => '40962', 'tag' => 'ExifImageWidth', 'categorie' => 'ExifIFD'),
'ExifImageHeight' => array('id' => '40963', 'tag' => 'ExifImageHeight', 'categorie' => 'ExifIFD'),
'PixelYDimension' => array('id' => '40963', 'tag' => 'ExifImageHeight', 'categorie' => 'ExifIFD'),
'RelatedSoundFile' => array('id' => '40964', 'tag' => 'RelatedSoundFile', 'categorie' => 'ExifIFD'),
'InteroperabilityOffset' => array('id' => '40965', 'tag' => 'InteropOffset', 'categorie' => 'Unknown'),
'SubjectLocation' => array('id' => '41492', 'tag' => 'SubjectLocation', 'categorie' => 'ExifIFD'),
'FileSource' => array('id' => '41728', 'tag' => 'FileSource', 'categorie' => 'ExifIFD'),
'SceneType' => array('id' => '41729', 'tag' => 'SceneType', 'categorie' => 'ExifIFD'),
'CFAPattern' => array('id' => '41730', 'tag' => 'CFAPattern', 'categorie' => 'ExifIFD'),
'CustomRendered' => array('id' => '41985', 'tag' => 'CustomRendered', 'categorie' => 'ExifIFD'),
'ExposureMode' => array('id' => '41986', 'tag' => 'ExposureMode', 'categorie' => 'ExifIFD'),
'WhiteBalance' => array('id' => '41987', 'tag' => 'WhiteBalance', 'categorie' => 'ExifIFD'),
'DigitalZoomRatio' => array('id' => '41988', 'tag' => 'DigitalZoomRatio', 'categorie' => 'ExifIFD'),
'FocalLengthIn35mmFormat' => array('id' => '41989', 'tag' => 'FocalLengthIn35mmFormat', 'categorie' => 'ExifIFD'),
'FocalLengthIn35mmFilm' => array('id' => '41989', 'tag' => 'FocalLengthIn35mmFormat', 'categorie' => 'ExifIFD'),
'SceneCaptureType' => array('id' => '41990', 'tag' => 'SceneCaptureType', 'categorie' => 'ExifIFD'),
'GainControl' => array('id' => '41991', 'tag' => 'GainControl', 'categorie' => 'ExifIFD'),
'Contrast' => array('id' => '41992', 'tag' => 'Contrast', 'categorie' => 'ExifIFD'),
'Saturation' => array('id' => '41993', 'tag' => 'Saturation', 'categorie' => 'ExifIFD'),
'Sharpness' => array('id' => '41994', 'tag' => 'Sharpness', 'categorie' => 'ExifIFD'),
'DeviceSettingDescription' => array('id' => '41995', 'tag' => 'DeviceSettingDescription', 'categorie' => 'Unknown'),
'SubjectDistanceRange' => array('id' => '41996', 'tag' => 'SubjectDistanceRange', 'categorie' => 'ExifIFD'),
'ImageUniqueID' => array('id' => '42016', 'tag' => 'ImageUniqueID', 'categorie' => 'ExifIFD'),
'OwnerName' => array('id' => '42032', 'tag' => 'OwnerName', 'categorie' => 'ExifIFD'),
'CameraOwnerName' => array('id' => '42032', 'tag' => 'OwnerName', 'categorie' => 'ExifIFD'),
'SerialNumber' => array('id' => '42033', 'tag' => 'SerialNumber', 'categorie' => 'ExifIFD'),
'BodySerialNumber' => array('id' => '42033', 'tag' => 'SerialNumber', 'categorie' => 'ExifIFD'),
'LensInfo' => array('id' => '42034', 'tag' => 'LensInfo', 'categorie' => 'ExifIFD'),
'LensSpecification' => array('id' => '42034', 'tag' => 'LensInfo', 'categorie' => 'ExifIFD'),
'LensMake' => array('id' => '42035', 'tag' => 'LensMake', 'categorie' => 'ExifIFD'),
'LensModel' => array('id' => '42036', 'tag' => 'LensModel', 'categorie' => 'ExifIFD'),
'LensSerialNumber' => array('id' => '42037', 'tag' => 'LensSerialNumber', 'categorie' => 'ExifIFD'),
'GDALMetadata' => array('id' => '42112', 'tag' => 'GDALMetadata', 'categorie' => 'Unknown'),
'GDALNoData' => array('id' => '42113', 'tag' => 'GDALNoData', 'categorie' => 'Unknown'),
'Gamma' => array('id' => '42240', 'tag' => 'Gamma', 'categorie' => 'ExifIFD'),
'ExpandSoftware' => array('id' => '44992', 'tag' => 'ExpandSoftware', 'categorie' => 'Unknown'),
'ExpandLens' => array('id' => '44993', 'tag' => 'ExpandLens', 'categorie' => 'Unknown'),
'ExpandFilm' => array('id' => '44994', 'tag' => 'ExpandFilm', 'categorie' => 'Unknown'),
'ExpandFilterLens' => array('id' => '44995', 'tag' => 'ExpandFilterLens', 'categorie' => 'Unknown'),
'ExpandScanner' => array('id' => '44996', 'tag' => 'ExpandScanner', 'categorie' => 'Unknown'),
'ExpandFlashLamp' => array('id' => '44997', 'tag' => 'ExpandFlashLamp', 'categorie' => 'Unknown'),
'PixelFormat' => array('id' => '48129', 'tag' => 'PixelFormat', 'categorie' => 'Unknown'),
'Transformation' => array('id' => '48130', 'tag' => 'Transformation', 'categorie' => 'Unknown'),
'Uncompressed' => array('id' => '48131', 'tag' => 'Uncompressed', 'categorie' => 'Unknown'),
'ImageType' => array('id' => '48132', 'tag' => 'ImageType', 'categorie' => 'Unknown'),
'ImageHeight' => array('id' => '48257', 'tag' => 'ImageHeight', 'categorie' => 'Unknown'),
'WidthResolution' => array('id' => '48258', 'tag' => 'WidthResolution', 'categorie' => 'Unknown'),
'HeightResolution' => array('id' => '48259', 'tag' => 'HeightResolution', 'categorie' => 'Unknown'),
'ImageOffset' => array('id' => '48320', 'tag' => 'ImageOffset', 'categorie' => 'Unknown'),
'ImageByteCount' => array('id' => '48321', 'tag' => 'ImageByteCount', 'categorie' => 'Unknown'),
'AlphaOffset' => array('id' => '48322', 'tag' => 'AlphaOffset', 'categorie' => 'Unknown'),
'AlphaByteCount' => array('id' => '48323', 'tag' => 'AlphaByteCount', 'categorie' => 'Unknown'),
'ImageDataDiscard' => array('id' => '48324', 'tag' => 'ImageDataDiscard', 'categorie' => 'Unknown'),
'AlphaDataDiscard' => array('id' => '48325', 'tag' => 'AlphaDataDiscard', 'categorie' => 'Unknown'),
'OceScanjobDesc' => array('id' => '50215', 'tag' => 'OceScanjobDesc', 'categorie' => 'Unknown'),
'OceApplicationSelector' => array('id' => '50216', 'tag' => 'OceApplicationSelector', 'categorie' => 'Unknown'),
'OceIDNumber' => array('id' => '50217', 'tag' => 'OceIDNumber', 'categorie' => 'Unknown'),
'OceImageLogic' => array('id' => '50218', 'tag' => 'OceImageLogic', 'categorie' => 'Unknown'),
'Annotations' => array('id' => '50255', 'tag' => 'Annotations', 'categorie' => 'Unknown'),
'PrintIM' => array('id' => '50341', 'tag' => 'PrintIM', 'categorie' => 'IFD0'),
'USPTOOriginalContentType' => array('id' => '50560', 'tag' => 'USPTOOriginalContentType', 'categorie' => 'Unknown'),
'DNGVersion' => array('id' => '50706', 'tag' => 'DNGVersion', 'categorie' => 'IFD0'),
'DNGBackwardVersion' => array('id' => '50707', 'tag' => 'DNGBackwardVersion', 'categorie' => 'IFD0'),
'UniqueCameraModel' => array('id' => '50708', 'tag' => 'UniqueCameraModel', 'categorie' => 'IFD0'),
'LocalizedCameraModel' => array('id' => '50709', 'tag' => 'LocalizedCameraModel', 'categorie' => 'IFD0'),
'CFAPlaneColor' => array('id' => '50710', 'tag' => 'CFAPlaneColor', 'categorie' => 'Unknown'),
'CFALayout' => array('id' => '50711', 'tag' => 'CFALayout', 'categorie' => 'Unknown'),
'LinearizationTable' => array('id' => '50712', 'tag' => 'LinearizationTable', 'categorie' => 'SubIFD'),
'BlackLevelRepeatDim' => array('id' => '50713', 'tag' => 'BlackLevelRepeatDim', 'categorie' => 'SubIFD'),
'BlackLevel' => array('id' => '50714', 'tag' => 'BlackLevel', 'categorie' => 'SubIFD'),
'BlackLevelDeltaH' => array('id' => '50715', 'tag' => 'BlackLevelDeltaH', 'categorie' => 'Unknown'),
'BlackLevelDeltaV' => array('id' => '50716', 'tag' => 'BlackLevelDeltaV', 'categorie' => 'Unknown'),
'WhiteLevel' => array('id' => '50717', 'tag' => 'WhiteLevel', 'categorie' => 'SubIFD'),
'DefaultScale' => array('id' => '50718', 'tag' => 'DefaultScale', 'categorie' => 'SubIFD'),
'DefaultCropOrigin' => array('id' => '50719', 'tag' => 'DefaultCropOrigin', 'categorie' => 'SubIFD'),
'DefaultCropSize' => array('id' => '50720', 'tag' => 'DefaultCropSize', 'categorie' => 'SubIFD'),
'ColorMatrix1' => array('id' => '50721', 'tag' => 'ColorMatrix1', 'categorie' => 'IFD0'),
'ColorMatrix2' => array('id' => '50722', 'tag' => 'ColorMatrix2', 'categorie' => 'IFD0'),
'CameraCalibration1' => array('id' => '50723', 'tag' => 'CameraCalibration1', 'categorie' => 'IFD0'),
'CameraCalibration2' => array('id' => '50724', 'tag' => 'CameraCalibration2', 'categorie' => 'IFD0'),
'ReductionMatrix1' => array('id' => '50725', 'tag' => 'ReductionMatrix1', 'categorie' => 'IFD0'),
'ReductionMatrix2' => array('id' => '50726', 'tag' => 'ReductionMatrix2', 'categorie' => 'IFD0'),
'AnalogBalance' => array('id' => '50727', 'tag' => 'AnalogBalance', 'categorie' => 'IFD0'),
'AsShotNeutral' => array('id' => '50728', 'tag' => 'AsShotNeutral', 'categorie' => 'IFD0'),
'AsShotWhiteXY' => array('id' => '50729', 'tag' => 'AsShotWhiteXY', 'categorie' => 'IFD0'),
'BaselineExposure' => array('id' => '50730', 'tag' => 'BaselineExposure', 'categorie' => 'IFD0'),
'BaselineNoise' => array('id' => '50731', 'tag' => 'BaselineNoise', 'categorie' => 'IFD0'),
'BaselineSharpness' => array('id' => '50732', 'tag' => 'BaselineSharpness', 'categorie' => 'IFD0'),
'BayerGreenSplit' => array('id' => '50733', 'tag' => 'BayerGreenSplit', 'categorie' => 'SubIFD'),
'LinearResponseLimit' => array('id' => '50734', 'tag' => 'LinearResponseLimit', 'categorie' => 'IFD0'),
'CameraSerialNumber' => array('id' => '50735', 'tag' => 'CameraSerialNumber', 'categorie' => 'IFD0'),
'DNGLensInfo' => array('id' => '50736', 'tag' => 'DNGLensInfo', 'categorie' => 'IFD0'),
'ChromaBlurRadius' => array('id' => '50737', 'tag' => 'ChromaBlurRadius', 'categorie' => 'SubIFD'),
'AntiAliasStrength' => array('id' => '50738', 'tag' => 'AntiAliasStrength', 'categorie' => 'SubIFD'),
'ShadowScale' => array('id' => '50739', 'tag' => 'ShadowScale', 'categorie' => 'IFD0'),
'SR2Private' => array('id' => '50740', 'tag' => 'SR2Private', 'categorie' => 'Unknown'),
'MakerNoteSafety' => array('id' => '50741', 'tag' => 'MakerNoteSafety', 'categorie' => 'IFD0'),
'RawImageSegmentation' => array('id' => '50752', 'tag' => 'RawImageSegmentation', 'categorie' => 'Unknown'),
'CalibrationIlluminant1' => array('id' => '50778', 'tag' => 'CalibrationIlluminant1', 'categorie' => 'IFD0'),
'CalibrationIlluminant2' => array('id' => '50779', 'tag' => 'CalibrationIlluminant2', 'categorie' => 'IFD0'),
'BestQualityScale' => array('id' => '50780', 'tag' => 'BestQualityScale', 'categorie' => 'SubIFD'),
'RawDataUniqueID' => array('id' => '50781', 'tag' => 'RawDataUniqueID', 'categorie' => 'IFD0'),
'AliasLayerMetadata' => array('id' => '50784', 'tag' => 'AliasLayerMetadata', 'categorie' => 'Unknown'),
'OriginalRawFileName' => array('id' => '50827', 'tag' => 'OriginalRawFileName', 'categorie' => 'IFD0'),
'OriginalRawFileData' => array('id' => '50828', 'tag' => 'OriginalRawFileData', 'categorie' => 'IFD0'),
'ActiveArea' => array('id' => '50829', 'tag' => 'ActiveArea', 'categorie' => 'SubIFD'),
'MaskedAreas' => array('id' => '50830', 'tag' => 'MaskedAreas', 'categorie' => 'SubIFD'),
'AsShotICCProfile' => array('id' => '50831', 'tag' => 'AsShotICCProfile', 'categorie' => 'IFD0'),
'AsShotPreProfileMatrix' => array('id' => '50832', 'tag' => 'AsShotPreProfileMatrix', 'categorie' => 'IFD0'),
'CurrentICCProfile' => array('id' => '50833', 'tag' => 'CurrentICCProfile', 'categorie' => 'IFD0'),
'CurrentPreProfileMatrix' => array('id' => '50834', 'tag' => 'CurrentPreProfileMatrix', 'categorie' => 'IFD0'),
'ColorimetricReference' => array('id' => '50879', 'tag' => 'ColorimetricReference', 'categorie' => 'IFD0'),
'PanasonicTitle' => array('id' => '50898', 'tag' => 'PanasonicTitle', 'categorie' => 'IFD0'),
'PanasonicTitle2' => array('id' => '50899', 'tag' => 'PanasonicTitle2', 'categorie' => 'IFD0'),
'CameraCalibrationSig' => array('id' => '50931', 'tag' => 'CameraCalibrationSig', 'categorie' => 'IFD0'),
'ProfileCalibrationSig' => array('id' => '50932', 'tag' => 'ProfileCalibrationSig', 'categorie' => 'IFD0'),
'ProfileIFD' => array('id' => '50933', 'tag' => 'ProfileIFD', 'categorie' => 'Unknown'),
'AsShotProfileName' => array('id' => '50934', 'tag' => 'AsShotProfileName', 'categorie' => 'IFD0'),
'NoiseReductionApplied' => array('id' => '50935', 'tag' => 'NoiseReductionApplied', 'categorie' => 'SubIFD'),
'ProfileName' => array('id' => '50936', 'tag' => 'ProfileName', 'categorie' => 'IFD0'),
'ProfileHueSatMapDims' => array('id' => '50937', 'tag' => 'ProfileHueSatMapDims', 'categorie' => 'IFD0'),
'ProfileHueSatMapData1' => array('id' => '50938', 'tag' => 'ProfileHueSatMapData1', 'categorie' => 'IFD0'),
'ProfileHueSatMapData2' => array('id' => '50939', 'tag' => 'ProfileHueSatMapData2', 'categorie' => 'IFD0'),
'ProfileToneCurve' => array('id' => '50940', 'tag' => 'ProfileToneCurve', 'categorie' => 'IFD0'),
'ProfileEmbedPolicy' => array('id' => '50941', 'tag' => 'ProfileEmbedPolicy', 'categorie' => 'IFD0'),
'ProfileCopyright' => array('id' => '50942', 'tag' => 'ProfileCopyright', 'categorie' => 'IFD0'),
'ForwardMatrix1' => array('id' => '50964', 'tag' => 'ForwardMatrix1', 'categorie' => 'IFD0'),
'ForwardMatrix2' => array('id' => '50965', 'tag' => 'ForwardMatrix2', 'categorie' => 'IFD0'),
'PreviewApplicationName' => array('id' => '50966', 'tag' => 'PreviewApplicationName', 'categorie' => 'IFD0'),
'PreviewApplicationVersion' => array('id' => '50967', 'tag' => 'PreviewApplicationVersion', 'categorie' => 'IFD0'),
'PreviewSettingsName' => array('id' => '50968', 'tag' => 'PreviewSettingsName', 'categorie' => 'IFD0'),
'PreviewSettingsDigest' => array('id' => '50969', 'tag' => 'PreviewSettingsDigest', 'categorie' => 'IFD0'),
'PreviewColorSpace' => array('id' => '50970', 'tag' => 'PreviewColorSpace', 'categorie' => 'IFD0'),
'PreviewDateTime' => array('id' => '50971', 'tag' => 'PreviewDateTime', 'categorie' => 'IFD0'),
'RawImageDigest' => array('id' => '50972', 'tag' => 'RawImageDigest', 'categorie' => 'IFD0'),
'OriginalRawFileDigest' => array('id' => '50973', 'tag' => 'OriginalRawFileDigest', 'categorie' => 'IFD0'),
'SubTileBlockSize' => array('id' => '50974', 'tag' => 'SubTileBlockSize', 'categorie' => 'Unknown'),
'RowInterleaveFactor' => array('id' => '50975', 'tag' => 'RowInterleaveFactor', 'categorie' => 'Unknown'),
'ProfileLookTableDims' => array('id' => '50981', 'tag' => 'ProfileLookTableDims', 'categorie' => 'IFD0'),
'ProfileLookTableData' => array('id' => '50982', 'tag' => 'ProfileLookTableData', 'categorie' => 'IFD0'),
'OpcodeList1' => array('id' => '51008', 'tag' => 'OpcodeList1', 'categorie' => 'Unknown'),
'OpcodeList2' => array('id' => '51009', 'tag' => 'OpcodeList2', 'categorie' => 'Unknown'),
'OpcodeList3' => array('id' => '51022', 'tag' => 'OpcodeList3', 'categorie' => 'Unknown'),
'NoiseProfile' => array('id' => '51041', 'tag' => 'NoiseProfile', 'categorie' => 'Unknown'),
'Padding' => array('id' => '59932', 'tag' => 'Padding', 'categorie' => 'ExifIFD'),
'OffsetSchema' => array('id' => '59933', 'tag' => 'OffsetSchema', 'categorie' => 'ExifIFD'),
'Lens' => array('id' => '65002', 'tag' => 'Lens', 'categorie' => 'ExifIFD'),
'KDC_IFD' => array('id' => '65024', 'tag' => 'KDC_IFD', 'categorie' => 'Unknown'),
'RawFile' => array('id' => '65100', 'tag' => 'RawFile', 'categorie' => 'ExifIFD'),
'Converter' => array('id' => '65101', 'tag' => 'Converter', 'categorie' => 'ExifIFD'),
'Exposure' => array('id' => '65105', 'tag' => 'Exposure', 'categorie' => 'ExifIFD'),
'Shadows' => array('id' => '65106', 'tag' => 'Shadows', 'categorie' => 'ExifIFD'),
'Brightness' => array('id' => '65107', 'tag' => 'Brightness', 'categorie' => 'ExifIFD'),
'Sharpness:65110' => array('id' => '65110', 'tag' => 'Sharpness', 'categorie' => 'ExifIFD'),
'Smoothness' => array('id' => '65111', 'tag' => 'Smoothness', 'categorie' => 'ExifIFD'),
'MoireFilter' => array('id' => '65112', 'tag' => 'MoireFilter', 'categorie' => 'ExifIFD'),
'FileName' => array('id' => 'php:1', 'tag' => 'FileName', 'categorie' => 'PhpFile'),
'FileDateTime' => array('id' => 'php:2', 'tag' => 'FileDateTime', 'categorie' => 'PhpFile'),
'FileSize' => array('id' => 'php:3', 'tag' => 'FileSize', 'categorie' => 'PhpFile'),
'FileType' => array('id' => 'php:4', 'tag' => 'FileType', 'categorie' => 'PhpFile'),
'MimeType' => array('id' => 'php:5', 'tag' => 'MimeType', 'categorie' => 'PhpFile'),
'SectionsFound' => array('id' => 'php:6', 'tag' => 'SectionsFound', 'categorie' => 'PhpFile'),
'JPEGInterchangeFormat' => array('id' => 'php:7', 'tag' => 'JPEGInterchangeFormat', 'categorie' => 'PhpThumbail'),
'JPEGInterchangeFormatLength' => array('id' => 'php:8', 'tag' => 'JPEGInterchangeFormatLength', 'categorie' => 'PhpThumbail'),
'Thumbnail.FileType' => array('id' => 'php:9', 'tag' => 'ThumbnailFileType', 'categorie' => 'PhpThumbail'),
'Thumbnail.MimeType' => array('id' => 'php:10', 'tag' => 'ThumbnailMimeType', 'categorie' => 'PhpThumbail'),
'Html' => array('id' => 'php:11', 'tag' => 'Html', 'categorie' => 'PhpComputed'),
'IsColor' => array('id' => 'php:12', 'tag' => 'IsColor', 'categorie' => 'PhpComputed'),
'ByteOrderMotorola' => array('id' => 'php:13', 'tag' => 'ByteOrderMotorola', 'categorie' => 'PhpComputed'),
'ApertureFNumber' => array('id' => 'php:14', 'tag' => 'ApertureFNumber', 'categorie' => 'PhpComputed'),
'UserCommentEncoding' => array('id' => 'php:15', 'tag' => 'UserCommentEncoding', 'categorie' => 'PhpComputed'),
'ExifImageLength' => array('id' => 'php:16', 'tag' => 'ExifImageLength', 'categorie' => 'PhpComputed'),
'InterOperabilityIndex' => array('id' => 'php:17', 'tag' => 'InterOperabilityIndex', 'categorie' => 'PhpComputed'),
'InterOperabilityVersion' => array('id' => 'php:18', 'tag' => 'InterOperabilityVersion', 'categorie' => 'PhpComputed'),
'SpecialMode' => array('id' => 'php:19', 'tag' => 'SpecialMode', 'categorie' => 'PhpComputed'),
'JPEGQuality' => array('id' => 'php:20', 'tag' => 'JPEGQuality', 'categorie' => 'PhpComputed'),
'Macro' => array('id' => 'php:21', 'tag' => 'Macro ', 'categorie' => 'PhpComputed'),
'DigitalZoom' => array('id' => 'php:22', 'tag' => 'DigitalZoom', 'categorie' => 'PhpComputed'),
'SoftwareRelease' => array('id' => 'php:23', 'tag' => 'SoftwareRelease', 'categorie' => 'PhpComputed'),
'PictureInfo' => array('id' => 'php:24', 'tag' => 'PictureInfo', 'categorie' => 'PhpComputed'),
'CameraId' => array('id' => 'php:25', 'tag' => 'CameraId', 'categorie' => 'PhpComputed'),
'Gps' => array('id' => 'php:26', 'tag' => 'Gps', 'categorie' => 'PhpComputed'),
'ACDComment' => array('id' => 'php:27', 'tag' => 'ACDComment', 'categorie' => 'PhpComputed'),
'NewSubFile' => array('id' => 'php:28', 'tag' => 'NewSubFile', 'categorie' => 'PhpComputed'),
'Comments' => array('id' => 'php:29', 'tag' => 'Comments', 'categorie' => 'PhpComputed'),
'TIFF/EPStandardID' => array('id' => 'php:30', 'tag' => 'TIFFEPStandardID', 'categorie' => 'PhpComputed'),
'ModeArray' => array('id' => 'php:31', 'tag' => 'ModeArray', 'categorie' => 'PhpComputed'),
'ImageInfo' => array('id' => 'php:32', 'tag' => 'ImageInfo', 'categorie' => 'PhpComputed'),
'FirmwareVersion' => array('id' => 'php:33', 'tag' => 'FirmwareVersion', 'categorie' => 'PhpComputed'),
'Camera' => array('id' => 'php:34', 'tag' => 'Camera', 'categorie' => 'PhpComputed'),
'CustomFunctions' => array('id' => 'php:35', 'tag' => 'CustomFunctions', 'categorie' => 'PhpComputed'),
'CCDWidth' => array('id' => 'php:36', 'tag' => 'CCDWidth', 'categorie' => 'PhpComputed'),
'FocusDistance' => array('id' => 'php:37', 'tag' => 'FocusDistance', 'categorie' => 'PhpComputed'),
'Keywords' => array('id' => 'php:38', 'tag' => 'Keywords', 'categorie' => 'PhpComputed'),
'GPSVersion' => array('id' => 'php:39', 'tag' => 'GPSVersion', 'categorie' => 'PhpComputed')
);
private $ids_tags_iptc = array(
'1#000' => array('id' => '0', 'tag' => 'ApplicationRecordVersion', 'categorie' => 'EnvelopeRecord'),
'1#090' => array('id' => '90', 'tag' => 'CodedCharacterSet', 'categorie' => 'EnvelopeRecord'),
'2#003' => array('id' => '3', 'tag' => 'ObjectTypeReference', 'categorie' => 'ApplicationRecord'),
'2#004' => array('id' => '4', 'tag' => 'ObjectAttributeReference', 'categorie' => 'ApplicationRecord'),
'2#005' => array('id' => '5', 'tag' => 'ObjectName', 'categorie' => 'ApplicationRecord'),
'2#007' => array('id' => '7', 'tag' => 'EditStatus', 'categorie' => 'ApplicationRecord'),
'2#008' => array('id' => '8', 'tag' => 'EditorialUpdate', 'categorie' => 'ApplicationRecord'),
'2#010' => array('id' => '10', 'tag' => 'Urgency', 'categorie' => 'ApplicationRecord'),
'2#012' => array('id' => '12', 'tag' => 'SubjectReference', 'categorie' => 'ApplicationRecord'),
'Category' => array('id' => '15', 'tag' => 'Category', 'categorie' => 'ApplicationRecord'),
'2#015' => array('id' => '15', 'tag' => 'Category', 'categorie' => 'ApplicationRecord'),
'2#020' => array('id' => '20', 'tag' => 'SupplementalCategories', 'categorie' => 'ApplicationRecord'),
'2#022' => array('id' => '22', 'tag' => 'FixtureIdentifier', 'categorie' => 'ApplicationRecord'),
'MotsCles' => array('id' => '25', 'tag' => 'Keywords', 'categorie' => 'ApplicationRecord'),
'2#026' => array('id' => '26', 'tag' => 'ContentLocationCode', 'categorie' => 'ApplicationRecord'),
'2#027' => array('id' => '27', 'tag' => 'ContentLocationName', 'categorie' => 'ApplicationRecord'),
'2#030' => array('id' => '30', 'tag' => 'ReleaseDate', 'categorie' => 'ApplicationRecord'),
'2#035' => array('id' => '35', 'tag' => 'ReleaseTime', 'categorie' => 'ApplicationRecord'),
'2#037' => array('id' => '37', 'tag' => 'ExpirationDate', 'categorie' => 'ApplicationRecord'),
'2#038' => array('id' => '38', 'tag' => 'ExpirationTime', 'categorie' => 'ApplicationRecord'),
'2#040' => array('id' => '40', 'tag' => 'SpecialInstructions', 'categorie' => 'ApplicationRecord'),
'2#042' => array('id' => '42', 'tag' => 'ActionAdvised', 'categorie' => 'ApplicationRecord'),
'2#045' => array('id' => '45', 'tag' => 'ReferenceService', 'categorie' => 'ApplicationRecord'),
'2#047' => array('id' => '47', 'tag' => 'ReferenceDate', 'categorie' => 'ApplicationRecord'),
'2#050' => array('id' => '50', 'tag' => 'ReferenceNumber', 'categorie' => 'ApplicationRecord'),
'2#055' => array('id' => '55', 'tag' => 'DateCreated', 'categorie' => 'ApplicationRecord'),
'2#060' => array('id' => '60', 'tag' => 'TimeCreated', 'categorie' => 'ApplicationRecord'),
'2#062' => array('id' => '62', 'tag' => 'DigitalCreationDate', 'categorie' => 'ApplicationRecord'),
'2#063' => array('id' => '63', 'tag' => 'DigitalCreationTime', 'categorie' => 'ApplicationRecord'),
'2#065' => array('id' => '65', 'tag' => 'OriginatingProgram', 'categorie' => 'ApplicationRecord'),
'2#070' => array('id' => '70', 'tag' => 'ProgramVersion', 'categorie' => 'ApplicationRecord'),
'2#075' => array('id' => '75', 'tag' => 'ObjectCycle', 'categorie' => 'ApplicationRecord'),
'ByLine' => array('id' => '80', 'tag' => 'By-line', 'categorie' => 'ApplicationRecord'),
'ByLineTitle' => array('id' => '85', 'tag' => 'By-lineTitle', 'categorie' => 'ApplicationRecord'),
'City' => array('id' => '90', 'tag' => 'City', 'categorie' => 'ApplicationRecord'),
'SubLocation' => array('id' => '92', 'tag' => 'Sub-location', 'categorie' => 'ApplicationRecord'),
'ProvinceState' => array('id' => '95', 'tag' => 'Province-State', 'categorie' => 'ApplicationRecord'),
'CountryPrimaryLocationCode' => array('id' => '100', 'tag' => 'Country-PrimaryLocationCode', 'categorie' => 'ApplicationRecord'),
'CountryName' => array('id' => '101', 'tag' => 'Country-PrimaryLocationName', 'categorie' => 'ApplicationRecord'),
'2#103' => array('id' => '103', 'tag' => 'OriginalTransmissionReference', 'categorie' => 'ApplicationRecord'),
'Headline' => array('id' => '105', 'tag' => 'Headline', 'categorie' => 'ApplicationRecord'),
'Credit' => array('id' => '110', 'tag' => 'Credit', 'categorie' => 'ApplicationRecord'),
'2#115' => array('id' => '115', 'tag' => 'Source', 'categorie' => 'ApplicationRecord'),
'CopyrightNotice' => array('id' => '116', 'tag' => 'CopyrightNotice', 'categorie' => 'ApplicationRecord'),
'Contact' => array('id' => '118', 'tag' => 'Contact', 'categorie' => 'ApplicationRecord'),
'2#120' => array('id' => '120', 'tag' => 'Caption-Abstract', 'categorie' => 'ApplicationRecord'),
'2#121' => array('id' => '121', 'tag' => 'LocalCaption', 'categorie' => 'ApplicationRecord'),
'2#122' => array('id' => '122', 'tag' => 'Writer-Editor', 'categorie' => 'ApplicationRecord'),
'2#125' => array('id' => '125', 'tag' => 'RasterizedCaption', 'categorie' => 'ApplicationRecord'),
'2#130' => array('id' => '130', 'tag' => 'ImageType', 'categorie' => 'ApplicationRecord'),
'2#131' => array('id' => '131', 'tag' => 'ImageOrientation', 'categorie' => 'ApplicationRecord'),
'2#135' => array('id' => '135', 'tag' => 'LanguageIdentifier', 'categorie' => 'ApplicationRecord'),
'2#150' => array('id' => '150', 'tag' => 'AudioType', 'categorie' => 'ApplicationRecord'),
'2#151' => array('id' => '151', 'tag' => 'AudioSamplingRate', 'categorie' => 'ApplicationRecord'),
'2#152' => array('id' => '152', 'tag' => 'AudioSamplingResolution', 'categorie' => 'ApplicationRecord'),
'2#153' => array('id' => '153', 'tag' => 'AudioDuration', 'categorie' => 'ApplicationRecord'),
'2#154' => array('id' => '154', 'tag' => 'AudioOutcue', 'categorie' => 'ApplicationRecord'),
'2#184' => array('id' => '184', 'tag' => 'JobID', 'categorie' => 'ApplicationRecord'),
'2#185' => array('id' => '185', 'tag' => 'MasterDocumentID', 'categorie' => 'ApplicationRecord'),
'2#186' => array('id' => '186', 'tag' => 'ShortDocumentID', 'categorie' => 'ApplicationRecord'),
'2#187' => array('id' => '187', 'tag' => 'UniqueDocumentID', 'categorie' => 'ApplicationRecord'),
'2#188' => array('id' => '188', 'tag' => 'OwnerID', 'categorie' => 'ApplicationRecord'),
'2#200' => array('id' => '200', 'tag' => 'ObjectPreviewFileFormat', 'categorie' => 'ApplicationRecord'),
'2#201' => array('id' => '201', 'tag' => 'ObjectPreviewFileVersion', 'categorie' => 'ApplicationRecord'),
'2#202' => array('id' => '202', 'tag' => 'ObjectPreviewData', 'categorie' => 'ApplicationRecord'),
'2#221' => array('id' => '221', 'tag' => 'Prefs', 'categorie' => 'ApplicationRecord'),
'2#225' => array('id' => '225', 'tag' => 'ClassifyState', 'categorie' => 'ApplicationRecord'),
'2#228' => array('id' => '228', 'tag' => 'SimilarityIndex', 'categorie' => 'ApplicationRecord'),
'2#230' => array('id' => '230', 'tag' => 'DocumentNotes', 'categorie' => 'ApplicationRecord'),
'2#231' => array('id' => '231', 'tag' => 'DocumentHistory', 'categorie' => 'ApplicationRecord'),
'2#232' => array('id' => '232', 'tag' => 'ExifCameraInfo', 'categorie' => 'ApplicationRecord'),
'2#242' => array('id' => '242', 'tag' => 'Unknown242', 'categorie' => 'Unknown'),
'2#254' => array('id' => '254', 'tag' => 'Unknown254', 'categorie' => 'Unknown'),
'2#255' => array('id' => '255', 'tag' => 'CatalogSets', 'categorie' => 'ApplicationRecord')
);
public function __construct(Conteneur $conteneur) {
$bddMigration = $conteneur->getParametre('database_cel.database_migration');
if ($bddMigration == null || $bddMigration == '') {
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";
exit;
}
$bddIdentification = $conteneur->getParametre('database_ident.database');
if ($bddIdentification == null || $bddIdentification == '') {
echo 'Attention la variable de configuration database dans la section database_ident, contenant la base de données utilisateurs, doit être remplie '."\n";
exit;
}
self::$bdd_cel_migration = $conteneur->getParametre('database_cel.database_migration');
self::$bdd_utilisateurs = $conteneur->getParametre('database_ident.database');
$this->bdd = $conteneur->getBdd();
$this->script = $conteneur->getScript();
$this->cle_id_metadonnees = array_merge($this->ids_tags_exif, $this->ids_tags_iptc);
}
/**
* Méthode appelée pour executer le script.
*/
public function executer($params) {
echo "--MIGRATION DES IMAGES --------------------------------------\n";
//1. TEMPORAIRE : vider les tables de destinations
if (self::truncate) {
echo "-------------------------------------------------------------------\n";
echo " ETAPE 0. Vider les tables ... \n";
echo "-------------------------------------------------------------------\n";
$nouvellesTables = array('cel_images', 'cel_obs_images');
foreach ($nouvellesTables as $nomTable) {
echo 'Vider la table '.$nomTable.'...';
$requeteTruncate = 'TRUNCATE TABLE '.self::$bdd_cel_migration.'.'.$nomTable;
$resultatTruncate = $this->bdd->executer($requeteTruncate);
echo "ok \n";
}
}
echo "-------------------------------------------------------------------\n";
echo " ETAPE 1. Paramétrage ... \n";
echo "-------------------------------------------------------------------\n";
$this->getUtilisateurs();
$this->getObservations();
echo "-------------------------------------------------------------------\n";
echo " ETAPE 2. Migration des images ... \n";
echo "-------------------------------------------------------------------\n";
$this->migrerImages();
$this->mettreANullPrenomNomVide();
$this->ordonnerImages();
echo "-------------------------------------------------------------------\n";
echo " ETAPE 3. migration des liaisons obs images ... \n";
echo "-------------------------------------------------------------------\n";
$this->migrerLiaisonsObsImages();
}
private function getUtilisateurs() {
echo "SELECTION DES UTILISATEURS\n";
$requete = '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';
$tableau_utilisateurs = $this->bdd->requeter($requete);
foreach ($tableau_utilisateurs as &$utilisateur) {
$this->tableau_utilisateurs[$utilisateur['mail']] = $utilisateur;
}
echo sizeof($this->tableau_utilisateurs)." utilisateurs sélectionnés\n";
}
private function getObservations() {
$pas = 5000;
$nObs = 'SELECT COUNT(*) AS nb FROM cel_inventory';
$resultatNbObs = $this->bdd->requeter($nObs, Bdd::SQL_RETOUR_COLONNE);
$nbObs = $resultatNbObs;
$maxLimite = $nbObs + $pas;
for ($i = 0; $i < $maxLimite; $i += $pas ) {
$requete_selection_observations = "SELECT id, ordre, identifiant FROM cel_inventory LIMIT $i,$pas ";
$tableau_observations = $this->bdd->requeter($requete_selection_observations);
foreach ($tableau_observations as &$obs) {
$this->tableau_observations[$obs['identifiant']][$obs['ordre']] = $obs['id'];
}
$this->script->afficherAvancement('Selection des observations (par '.$pas.' )');
}
echo "\n";
}
private function migrerImages() {
$pas = 100;
//Selectionner le nombre d'images
$requeteNbImg = "SELECT COUNT(*) as nb FROM cel_images";
$fin = $this->bdd->requeter($requeteNbImg, BDD::SQL_RETOUR_COLONNE);
$maxLimite = $fin + $pas;
for ($i = 0; $i <= $maxLimite ; $i += $pas) {
$requete = "SELECT * FROM cel_images ORDER BY ci_id_image ASC LIMIT $i,$pas ";
$images = $this->bdd->requeter($requete);
if (is_array($images)) {
$imagesNouvelles = array();
foreach ($images as $image) {
$image = $this->traiterLigneImage($image);
$image = array_map(array($this, 'protegerSiNonNull'), $image);
$imagesNouvelles[] = '('.implode(',', array_values($image)).')';
}
$bdd = self::$bdd_cel_migration;
$champs = implode(', ', array_keys($this->tableau_nouveau_ancien));
$values = implode(',', $imagesNouvelles);
$requete = "INSERT INTO $bdd.cel_images ($champs) VALUES $values ";
$migration_images = $this->executerRequeteSimple($requete);
if (!$migration_images) {
echo 'La migration des images '.$i.' à '.($i + count($images)).' a échoué '."\n";
file_put_contents('/home/jpm/requete.sql', $requete);
} else {
$this->script->afficherAvancement('Migration des images (par '.$pas.' )');
}
}
if (count($images) < $pas) {
echo "\n";
return;
}
}
}
private function ordonnerImages() {
$requete = 'ALTER TABLE '.self::$bdd_cel_migration.'.cel_images ORDER BY id_image';
$this->executerRequeteSimple($requete);
}
private function executerRequeteSimple($requete) {
// Fonction de commodité pour afficher les requetes au lieu de les executer
if (self::dry_run) {
echo str_replace('),','),'."\n", $requete)."\n";
return true;
} else {
return $this->bdd->executer($requete);
}
}
private function traiterLigneImage($image) {
$nouvelle_image = array();
foreach ($this->tableau_nouveau_ancien as $nouveau_champ_image => $ancien_champ_image) {
if ($this->estUnChampATraiter($ancien_champ_image)) {
if (method_exists($this,$ancien_champ_image)) {
$nouvelle_image[$nouveau_champ_image] = $this->$ancien_champ_image($image);
} else {
echo 'methode manquante : '.$ancien_champ_image."\n";
$nouvelle_image[$nouveau_champ_image] = '';
}
} else {
$nouvelle_image[$nouveau_champ_image] = $image[$ancien_champ_image];
}
}
return $nouvelle_image;
}
private function estUnChampATraiter($champ) {
return strpos($champ, 'traiter') !== false;
}
private function protegerSiNonNull($valeur) {
if ($valeur != 'NULL') {
$valeur = $this->bdd->proteger($valeur);
}
return $valeur;
}
private function traiterIdentifiantUtilisateur($ligne_image) {
$mail_image = $ligne_image['ci_ce_utilisateur'];
$retour = $this->renvoyerIdPourMigration($mail_image);
return $retour;
}
private function renvoyerIdPourMigration($utilisateur) {
// si tout les test suivant échouent, on garde l'utilisateur tel quel (cas de la chaine de session des utilisateur anonymes)
$retour = $utilisateur;
// si le mail correspond a un utilisateur de la bdd
if (isset($this->tableau_utilisateurs[$utilisateur])) {
// on renvoie son id
$retour = $this->tableau_utilisateurs[$utilisateur]['id'];
} else {
// sinon si c'est un mail inconnu, on garde le md5
if($this->mailValide($utilisateur)) {
$retour = md5($utilisateur);
}
}
return $retour;
}
private function mailValide($mail) {
// vérification bidon mais ça suffit pour ici
return !(strpos($mail, '@') === false);
}
private function traiterPrenomUtilisateur($ligne_image) {
$mail_image = $ligne_image['ci_ce_utilisateur'];
$retour = $mail_image;
if (isset($this->tableau_utilisateurs[$mail_image])) {
$retour = self::formaterMotPremiereLettreChaqueMotEnMajuscule($this->tableau_utilisateurs[$mail_image]['prenom']);
} else {
$retour = '';
}
return $retour;
}
public static function formaterMotPremiereLettreChaqueMotEnMajuscule($chaine, $encodage= 'UTF-8') {
$chaine = str_replace('-', ' - ', $chaine);
$chaine = mb_strtolower($chaine, $encodage);
$chaine = mb_convert_case($chaine, MB_CASE_TITLE, $encodage);
$chaine = str_replace(' - ', '-', $chaine);
return $chaine;
}
private function traiterNomUtilisateur($ligne_image) {
$mail_image = $ligne_image['ci_ce_utilisateur'];
$retour = $mail_image;
if (isset($this->tableau_utilisateurs[$mail_image])) {
$retour = self::formaterMotEnMajuscule($this->tableau_utilisateurs[$mail_image]['nom']);
} else {
$retour = '';
}
return $retour;
}
public static function formaterMotEnMajuscule($chaine, $encodage= 'UTF-8') {
return mb_convert_case($chaine, MB_CASE_UPPER, $encodage);
}
private function traiterNoteImage($image) {
$retour = $image['ci_note_image'];
if ($image['ci_note_image'] == '-1') {
$retour = 'NULL';
}
return $retour;
}
private function traiterExif($ligne_image) {
$metadonnees_autres = $this->decoderTableauMetaDonnees($ligne_image['ci_meta_exif_autres']);
$metadonnees = array_intersect_key($ligne_image, array_flip($this->champs_exifs_non_gardes))+$metadonnees_autres;
$retour = 'NULL';
if ($xml = $this->convertirTableauMetadonneesEnXml($metadonnees)) {
$retour = '<?xml version="1.0" encoding="UTF-8" ?>'."\n".
'<exif>'."\n".$xml.'</exif>';
}
return $retour;
}
private function traiterIptc($ligne_image) {
$metadonnees_autres = $this->decoderTableauMetaDonnees($ligne_image['ci_meta_iptc_autres']);
$metadonnees = array_intersect_key($ligne_image, array_flip($this->champs_iptc_non_gardes)) + $metadonnees_autres;
$retour = 'NULL';
if ($xml = $this->convertirTableauMetadonneesEnXml($metadonnees)) {
$retour = '<?xml version="1.0" encoding="UTF-8" ?>'."\n".
'<iptc>'."\n".$xml.'</iptc>';
}
return $retour;
}
private function traiterXmp($ligne_image) {
$retour = 'NULL';
return $retour;
}
private function traiterMakernote($ligne_image) {
$retour = 'NULL';
return $retour;
}
private function decoderTableauMetaDonnees($chaine) {
$tableau_valeurs_decodees = array();
if (trim($chaine) != '') {
$tableau_meta = explode(self::separateur_champs_metadonnees, $chaine);
foreach ($tableau_meta as &$chaine_meta) {
if (strpos($chaine_meta, 'UndefinedTag:') !== false) {
$chaine_meta = str_replace('UndefinedTag:', 'UndefinedTag', $chaine_meta);
}
$cle_valeur = explode(self::separateur_valeurs_metadonnees, $chaine_meta, 2);
if (is_array($cle_valeur) && count($cle_valeur) == 2) {
$cle = ltrim($cle_valeur[0], ' ');
$tableau_valeurs_decodees[$cle] = $cle_valeur[1];
}
}
}
return $tableau_valeurs_decodees;
}
private function convertirTableauMetadonneesEnXml($tableau) {
$xml = '';
foreach ($tableau as $cle => $valeur) {
$cle = str_replace('ci_meta_exif_', '', $cle);
$cle = str_replace('ci_meta_iptc_', '', $cle);
$cle = str_replace('ci_meta_', '', $cle);
$cle = str_replace('_', ' ', $cle);
$cle = ucwords($cle);
$cle = str_replace(' ', '', $cle);
$valeur = str_replace("\0", '', $valeur);
if (isset($this->cle_id_metadonnees[$cle])) {
$id = $this->cle_id_metadonnees[$cle]['id'];
$tag = $this->cle_id_metadonnees[$cle]['tag'];
$categorie = $this->cle_id_metadonnees[$cle]['categorie'];
$xml .= '<'.$tag.' id="'.$id.'" categorie="'.$categorie.'">'.$valeur.'</'.$tag.'>'."\n";
} else {
$xml .= '<'.$cle.' categorie="Undefined">'.$valeur.'</'.$cle.'>'."\n";
}
}
return $xml;
}
private function migrerLiaisonsObsImages() {
$pas = 500;
$liaisons_obs_inexistantes = 0;
//Selectionner le nombre de liaisons
$requeteNbImgObs = "SELECT COUNT(*) AS nb FROM cel_obs_images";
$fin = $this->bdd->requeter($requeteNbImgObs, Bdd::SQL_RETOUR_COLONNE);
echo "Nbre de liaisons à migrer : $fin\n";
for ($i = 0; $i <= $fin ; $i += $pas) {
$requete = "SELECT * FROM cel_obs_images LIMIT $i,$pas ";
$tableau_liaisons = $this->bdd->requeter($requete);
if (is_array($tableau_liaisons)) {
$liaisonsNouvelles = array();
foreach ($tableau_liaisons as $liaison) {
$mail_utilisateur = $liaison['coi_ce_utilisateur'];
$ordre_obs = $liaison['coi_ce_observation'];
if (isset($this->tableau_observations[$mail_utilisateur][$ordre_obs])) {
$id_obs = $this->bdd->proteger($this->tableau_observations[$mail_utilisateur][$ordre_obs]);
$id_image = $this->bdd->proteger($liaison['coi_ce_image']);
$date_liaison = $this->bdd->proteger($liaison['coi_date_liaison']);
$liaisonsNouvelles[] = "($id_image, $id_obs, $date_liaison)";
} else {
// cas d'une observation inexistante, la liaison est ignorée
$liaisons_obs_inexistantes++;
}
}
if (count($liaisonsNouvelles) != 0) {
$sousRequete = implode(',', $liaisonsNouvelles);
$requete = 'INSERT INTO '.self::$bdd_cel_migration.'.cel_obs_images '.
'(id_image, id_observation, date_liaison) '.
"VALUES $sousRequete ";
$migration_liaison = $this->executerRequeteSimple($requete);
if (!$migration_liaison) {
echo 'La migration des liaisons obs images de '.$i.' à '.($i+$pas).' a échoué ! '."\n<br />";
} else {
$this->script->afficherAvancement('Migration des liaisons obs images (par '.$pas.' )');
}
}
}
}
echo "\n";
echo $liaisons_obs_inexistantes ? $liaisons_obs_inexistantes." liaisons image obs ont été ignorées car les obs sont absentes\n" : '' ;
}
private function mettreANullPrenomNomVide() {
$bdd = self::$bdd_cel_migration;
$requete = "UPDATE $bdd.cel_images ".
'SET prenom_utilisateur = NULL '.
"WHERE prenom_utilisateur = '' ";
$this->bdd->executer($requete);
$requete = "UPDATE $bdd.cel_images ".
'SET nom_utilisateur = NULL '.
"WHERE nom_utilisateur = '' ";
$this->bdd->executer($requete);
}
}