Subversion Repositories eFlore/Applications.cel

Rev

Rev 3574 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3574 Rev 3577
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe d'extraction de metadonnées d'un fichier JPEG afin de les mettre dans un tableau au format du CEL.
4
 * Classe d'extraction de metadonnées d'un fichier JPEG afin de les mettre dans un tableau au format du CEL.
5
 *
5
 *
6
 * @internal   Mininum PHP version : 5.2
6
 * @internal   Mininum PHP version : 5.2
7
 * @category   CEL
7
 * @category   CEL
8
 * @package    Services
8
 * @package    Services
9
 * @subpackage Bibliothèques
9
 * @subpackage Bibliothèques
10
 * @version    0.1
10
 * @version    0.1
11
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
11
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
12
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
13
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
13
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
14
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
14
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
15
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
15
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
17
 */
17
 */
18
class ExtracteurMetadonnees {
18
class ExtracteurMetadonnees {
19
 
19
 
20
	private $meta = array();
20
	private $meta = array();
21
	private $tableau_ids_tags_exif = array(
21
	private $tableau_ids_tags_exif = array(
22
			'InteropIndex' => '1',
22
			'InteropIndex' => '1',
23
			'InteropVersion' => '2',
23
			'InteropVersion' => '2',
24
			'ProcessingSoftware' => '11',
24
			'ProcessingSoftware' => '11',
25
			'SubfileType' => '254',
25
			'SubfileType' => '254',
26
			'OldSubfileType' => '255',
26
			'OldSubfileType' => '255',
27
			'ImageWidth' => '256',
27
			'ImageWidth' => '256',
28
			'ImageHeight' => '257',
28
			'ImageHeight' => '257',
29
			'BitsPerSample' => '258',
29
			'BitsPerSample' => '258',
30
			'Compression' => '259',
30
			'Compression' => '259',
31
			'PhotometricInterpretation' => '262',
31
			'PhotometricInterpretation' => '262',
32
			'Thresholding' => '263',
32
			'Thresholding' => '263',
33
			'CellWidth' => '264',
33
			'CellWidth' => '264',
34
			'CellLength' => '265',
34
			'CellLength' => '265',
35
			'FillOrder' => '266',
35
			'FillOrder' => '266',
36
			'DocumentName' => '269',
36
			'DocumentName' => '269',
37
			'ImageDescription' => '270',
37
			'ImageDescription' => '270',
38
			'Make' => '271',
38
			'Make' => '271',
39
			'Model' => '272',
39
			'Model' => '272',
40
			'StripOffsets' => '273',
40
			'StripOffsets' => '273',
41
			'Orientation' => '274',
41
			'Orientation' => '274',
42
			'SamplesPerPixel' => '277',
42
			'SamplesPerPixel' => '277',
43
			'RowsPerStrip' => '278',
43
			'RowsPerStrip' => '278',
44
			'StripByteCounts' => '279',
44
			'StripByteCounts' => '279',
45
			'MinSampleValue' => '280',
45
			'MinSampleValue' => '280',
46
			'MaxSampleValue' => '281',
46
			'MaxSampleValue' => '281',
47
			'XResolution' => '282',
47
			'XResolution' => '282',
48
			'YResolution' => '283',
48
			'YResolution' => '283',
49
			'PlanarConfiguration' => '284',
49
			'PlanarConfiguration' => '284',
50
			'PageName' => '285',
50
			'PageName' => '285',
51
			'XPosition' => '286',
51
			'XPosition' => '286',
52
			'YPosition' => '287',
52
			'YPosition' => '287',
53
			'FreeOffsets' => '288',
53
			'FreeOffsets' => '288',
54
			'FreeByteCounts' => '289',
54
			'FreeByteCounts' => '289',
55
			'GrayResponseUnit' => '290',
55
			'GrayResponseUnit' => '290',
56
			'GrayResponseCurve' => '291',
56
			'GrayResponseCurve' => '291',
57
			'T4Options' => '292',
57
			'T4Options' => '292',
58
			'T6Options' => '293',
58
			'T6Options' => '293',
59
			'ResolutionUnit' => '296',
59
			'ResolutionUnit' => '296',
60
			'PageNumber' => '297',
60
			'PageNumber' => '297',
61
			'ColorResponseUnit' => '300',
61
			'ColorResponseUnit' => '300',
62
			'TransferFunction' => '301',
62
			'TransferFunction' => '301',
63
			'Software' => '305',
63
			'Software' => '305',
64
			'ModifyDate' => '306',
64
			'ModifyDate' => '306',
65
			'Artist' => '315',
65
			'Artist' => '315',
66
			'HostComputer' => '316',
66
			'HostComputer' => '316',
67
			'Predictor' => '317',
67
			'Predictor' => '317',
68
			'WhitePoint' => '318',
68
			'WhitePoint' => '318',
69
			'PrimaryChromaticities' => '319',
69
			'PrimaryChromaticities' => '319',
70
			'ColorMap' => '320',
70
			'ColorMap' => '320',
71
			'HalftoneHints' => '321',
71
			'HalftoneHints' => '321',
72
			'TileWidth' => '322',
72
			'TileWidth' => '322',
73
			'TileLength' => '323',
73
			'TileLength' => '323',
74
			'TileOffsets' => '324',
74
			'TileOffsets' => '324',
75
			'TileByteCounts' => '325',
75
			'TileByteCounts' => '325',
76
			'BadFaxLines' => '326',
76
			'BadFaxLines' => '326',
77
			'CleanFaxData' => '327',
77
			'CleanFaxData' => '327',
78
			'ConsecutiveBadFaxLines' => '328',
78
			'ConsecutiveBadFaxLines' => '328',
79
			'SubIFD' => '330',
79
			'SubIFD' => '330',
80
			'InkSet' => '332',
80
			'InkSet' => '332',
81
			'InkNames' => '333',
81
			'InkNames' => '333',
82
			'NumberofInks' => '334',
82
			'NumberofInks' => '334',
83
			'DotRange' => '336',
83
			'DotRange' => '336',
84
			'TargetPrinter' => '337',
84
			'TargetPrinter' => '337',
85
			'ExtraSamples' => '338',
85
			'ExtraSamples' => '338',
86
			'SampleFormat' => '339',
86
			'SampleFormat' => '339',
87
			'SMinSampleValue' => '340',
87
			'SMinSampleValue' => '340',
88
			'SMaxSampleValue' => '341',
88
			'SMaxSampleValue' => '341',
89
			'TransferRange' => '342',
89
			'TransferRange' => '342',
90
			'ClipPath' => '343',
90
			'ClipPath' => '343',
91
			'XClipPathUnits' => '344',
91
			'XClipPathUnits' => '344',
92
			'YClipPathUnits' => '345',
92
			'YClipPathUnits' => '345',
93
			'Indexed' => '346',
93
			'Indexed' => '346',
94
			'JPEGTables' => '347',
94
			'JPEGTables' => '347',
95
			'OPIProxy' => '351',
95
			'OPIProxy' => '351',
96
			'GlobalParametersIFD' => '400',
96
			'GlobalParametersIFD' => '400',
97
			'ProfileType' => '401',
97
			'ProfileType' => '401',
98
			'FaxProfile' => '402',
98
			'FaxProfile' => '402',
99
			'CodingMethods' => '403',
99
			'CodingMethods' => '403',
100
			'VersionYear' => '404',
100
			'VersionYear' => '404',
101
			'ModeNumber' => '405',
101
			'ModeNumber' => '405',
102
			'Decode' => '433',
102
			'Decode' => '433',
103
			'DefaultImageColor' => '434',
103
			'DefaultImageColor' => '434',
104
			'T82Options' => '435',
104
			'T82Options' => '435',
105
			'JPEGTables' => '437',
105
			'JPEGTables' => '437',
106
			'JPEGProc' => '512',
106
			'JPEGProc' => '512',
107
			'ThumbnailOffset' => '513',
107
			'ThumbnailOffset' => '513',
108
			'ThumbnailLength' => '514',
108
			'ThumbnailLength' => '514',
109
			'JPEGRestartInterval' => '515',
109
			'JPEGRestartInterval' => '515',
110
			'JPEGLosslessPredictors' => '517',
110
			'JPEGLosslessPredictors' => '517',
111
			'JPEGPointTransforms' => '518',
111
			'JPEGPointTransforms' => '518',
112
			'JPEGQTables' => '519',
112
			'JPEGQTables' => '519',
113
			'JPEGDCTables' => '520',
113
			'JPEGDCTables' => '520',
114
			'JPEGACTables' => '521',
114
			'JPEGACTables' => '521',
115
			'YCbCrCoefficients' => '529',
115
			'YCbCrCoefficients' => '529',
116
			'YCbCrSubSampling' => '530',
116
			'YCbCrSubSampling' => '530',
117
			'YCbCrPositioning' => '531',
117
			'YCbCrPositioning' => '531',
118
			'ReferenceBlackWhite' => '532',
118
			'ReferenceBlackWhite' => '532',
119
			'StripRowCounts' => '559',
119
			'StripRowCounts' => '559',
120
			'ApplicationNotes' => '700',
120
			'ApplicationNotes' => '700',
121
			'USPTOMiscellaneous' => '999',
121
			'USPTOMiscellaneous' => '999',
122
			'RelatedImageFileFormat' => '4096',
122
			'RelatedImageFileFormat' => '4096',
123
			'RelatedImageWidth' => '4097',
123
			'RelatedImageWidth' => '4097',
124
			'RelatedImageHeight' => '4098',
124
			'RelatedImageHeight' => '4098',
125
			'Rating' => '18246',
125
			'Rating' => '18246',
126
			'XP_DIP_XML' => '18247',
126
			'XP_DIP_XML' => '18247',
127
			'StitchInfo' => '18248',
127
			'StitchInfo' => '18248',
128
			'RatingPercent' => '18249',
128
			'RatingPercent' => '18249',
129
			'ImageID' => '32781',
129
			'ImageID' => '32781',
130
			'WangTag1' => '32931',
130
			'WangTag1' => '32931',
131
			'WangAnnotation' => '32932',
131
			'WangAnnotation' => '32932',
132
			'WangTag3' => '32933',
132
			'WangTag3' => '32933',
133
			'WangTag4' => '32934',
133
			'WangTag4' => '32934',
134
			'Matteing' => '32995',
134
			'Matteing' => '32995',
135
			'DataType' => '32996',
135
			'DataType' => '32996',
136
			'ImageDepth' => '32997',
136
			'ImageDepth' => '32997',
137
			'TileDepth' => '32998',
137
			'TileDepth' => '32998',
138
			'Model2' => '33405',
138
			'Model2' => '33405',
139
			'CFARepeatPatternDim' => '33421',
139
			'CFARepeatPatternDim' => '33421',
140
			'CFAPattern2' => '33422',
140
			'CFAPattern2' => '33422',
141
			'BatteryLevel' => '33423',
141
			'BatteryLevel' => '33423',
142
			'KodakIFD' => '33424',
142
			'KodakIFD' => '33424',
143
			'Copyright' => '33432',
143
			'Copyright' => '33432',
144
			'ExposureTime' => '33434',
144
			'ExposureTime' => '33434',
145
			'FNumber' => '33437',
145
			'FNumber' => '33437',
146
			'MDFileTag' => '33445',
146
			'MDFileTag' => '33445',
147
			'MDScalePixel' => '33446',
147
			'MDScalePixel' => '33446',
148
			'MDColorTable' => '33447',
148
			'MDColorTable' => '33447',
149
			'MDLabName' => '33448',
149
			'MDLabName' => '33448',
150
			'MDSampleInfo' => '33449',
150
			'MDSampleInfo' => '33449',
151
			'MDPrepDate' => '33450',
151
			'MDPrepDate' => '33450',
152
			'MDPrepTime' => '33451',
152
			'MDPrepTime' => '33451',
153
			'MDFileUnits' => '33452',
153
			'MDFileUnits' => '33452',
154
			'PixelScale' => '33550',
154
			'PixelScale' => '33550',
155
			'AdventScale' => '33589',
155
			'AdventScale' => '33589',
156
			'AdventRevision' => '33590',
156
			'AdventRevision' => '33590',
157
			'UIC1Tag' => '33628',
157
			'UIC1Tag' => '33628',
158
			'UIC2Tag' => '33629',
158
			'UIC2Tag' => '33629',
159
			'UIC3Tag' => '33630',
159
			'UIC3Tag' => '33630',
160
			'UIC4Tag' => '33631',
160
			'UIC4Tag' => '33631',
161
			'IPTC-NAA' => '33723',
161
			'IPTC-NAA' => '33723',
162
			'IntergraphPacketData' => '33918',
162
			'IntergraphPacketData' => '33918',
163
			'IntergraphFlagRegisters' => '33919',
163
			'IntergraphFlagRegisters' => '33919',
164
			'IntergraphMatrix' => '33920',
164
			'IntergraphMatrix' => '33920',
165
			'INGRReserved' => '33921',
165
			'INGRReserved' => '33921',
166
			'ModelTiePoint' => '33922',
166
			'ModelTiePoint' => '33922',
167
			'Site' => '34016',
167
			'Site' => '34016',
168
			'ColorSequence' => '34017',
168
			'ColorSequence' => '34017',
169
			'IT8Header' => '34018',
169
			'IT8Header' => '34018',
170
			'RasterPadding' => '34019',
170
			'RasterPadding' => '34019',
171
			'BitsPerRunLength' => '34020',
171
			'BitsPerRunLength' => '34020',
172
			'BitsPerExtendedRunLength' => '34021',
172
			'BitsPerExtendedRunLength' => '34021',
173
			'ColorTable' => '34022',
173
			'ColorTable' => '34022',
174
			'ImageColorIndicator' => '34023',
174
			'ImageColorIndicator' => '34023',
175
			'BackgroundColorIndicator' => '34024',
175
			'BackgroundColorIndicator' => '34024',
176
			'ImageColorValue' => '34025',
176
			'ImageColorValue' => '34025',
177
			'BackgroundColorValue' => '34026',
177
			'BackgroundColorValue' => '34026',
178
			'PixelIntensityRange' => '34027',
178
			'PixelIntensityRange' => '34027',
179
			'TransparencyIndicator' => '34028',
179
			'TransparencyIndicator' => '34028',
180
			'ColorCharacterization' => '34029',
180
			'ColorCharacterization' => '34029',
181
			'HCUsage' => '34030',
181
			'HCUsage' => '34030',
182
			'TrapIndicator' => '34031',
182
			'TrapIndicator' => '34031',
183
			'CMYKEquivalent' => '34032',
183
			'CMYKEquivalent' => '34032',
184
			'SEMInfo' => '34118',
184
			'SEMInfo' => '34118',
185
			'AFCP_IPTC' => '34152',
185
			'AFCP_IPTC' => '34152',
186
			'PixelMagicJBIGOptions' => '34232',
186
			'PixelMagicJBIGOptions' => '34232',
187
			'ModelTransform' => '34264',
187
			'ModelTransform' => '34264',
188
			'WB_GRGBLevels' => '34306',
188
			'WB_GRGBLevels' => '34306',
189
			'LeafData' => '34310',
189
			'LeafData' => '34310',
190
			'PhotoshopSettings' => '34377',
190
			'PhotoshopSettings' => '34377',
191
			'ExifOffset' => '34665',
191
			'ExifOffset' => '34665',
192
			'ICC_Profile' => '34675',
192
			'ICC_Profile' => '34675',
193
			'TIFF_FXExtensions' => '34687',
193
			'TIFF_FXExtensions' => '34687',
194
			'MultiProfiles' => '34688',
194
			'MultiProfiles' => '34688',
195
			'SharedData' => '34689',
195
			'SharedData' => '34689',
196
			'T88Options' => '34690',
196
			'T88Options' => '34690',
197
			'ImageLayer' => '34732',
197
			'ImageLayer' => '34732',
198
			'GeoTiffDirectory' => '34735',
198
			'GeoTiffDirectory' => '34735',
199
			'GeoTiffDoubleParams' => '34736',
199
			'GeoTiffDoubleParams' => '34736',
200
			'GeoTiffAsciiParams' => '34737',
200
			'GeoTiffAsciiParams' => '34737',
201
			'ExposureProgram' => '34850',
201
			'ExposureProgram' => '34850',
202
			'SpectralSensitivity' => '34852',
202
			'SpectralSensitivity' => '34852',
203
			'GPSInfo' => '34853',
203
			'GPSInfo' => '34853',
204
			'ISO' => '34855',
204
			'ISO' => '34855',
205
			'Opto-ElectricConvFactor' => '34856',
205
			'Opto-ElectricConvFactor' => '34856',
206
			'Interlace' => '34857',
206
			'Interlace' => '34857',
207
			'TimeZoneOffset' => '34858',
207
			'TimeZoneOffset' => '34858',
208
			'SelfTimerMode' => '34859',
208
			'SelfTimerMode' => '34859',
209
			'SensitivityType' => '34864',
209
			'SensitivityType' => '34864',
210
			'StandardOutputSensitivity' => '34865',
210
			'StandardOutputSensitivity' => '34865',
211
			'RecommendedExposureIndex' => '34866',
211
			'RecommendedExposureIndex' => '34866',
212
			'ISOSpeed' => '34867',
212
			'ISOSpeed' => '34867',
213
			'ISOSpeedLatitudeyyy' => '34868',
213
			'ISOSpeedLatitudeyyy' => '34868',
214
			'ISOSpeedLatitudezzz' => '34869',
214
			'ISOSpeedLatitudezzz' => '34869',
215
			'FaxRecvParams' => '34908',
215
			'FaxRecvParams' => '34908',
216
			'FaxSubAddress' => '34909',
216
			'FaxSubAddress' => '34909',
217
			'FaxRecvTime' => '34910',
217
			'FaxRecvTime' => '34910',
218
			'LeafSubIFD' => '34954',
218
			'LeafSubIFD' => '34954',
219
			'ExifVersion' => '36864',
219
			'ExifVersion' => '36864',
220
			'DateTimeOriginal' => '36867',
220
			'DateTimeOriginal' => '36867',
221
			'CreateDate' => '36868',
221
			'CreateDate' => '36868',
222
			'ComponentsConfiguration' => '37121',
222
			'ComponentsConfiguration' => '37121',
223
			'CompressedBitsPerPixel' => '37122',
223
			'CompressedBitsPerPixel' => '37122',
224
			'ShutterSpeedValue' => '37377',
224
			'ShutterSpeedValue' => '37377',
225
			'ApertureValue' => '37378',
225
			'ApertureValue' => '37378',
226
			'BrightnessValue' => '37379',
226
			'BrightnessValue' => '37379',
227
			'ExposureCompensation' => '37380',
227
			'ExposureCompensation' => '37380',
228
			'MaxApertureValue' => '37381',
228
			'MaxApertureValue' => '37381',
229
			'SubjectDistance' => '37382',
229
			'SubjectDistance' => '37382',
230
			'MeteringMode' => '37383',
230
			'MeteringMode' => '37383',
231
			'LightSource' => '37384',
231
			'LightSource' => '37384',
232
			'Flash' => '37385',
232
			'Flash' => '37385',
233
			'FocalLength' => '37386',
233
			'FocalLength' => '37386',
234
			'FlashEnergy' => '37387',
234
			'FlashEnergy' => '37387',
235
			'SpatialFrequencyResponse' => '37388',
235
			'SpatialFrequencyResponse' => '37388',
236
			'Noise' => '37389',
236
			'Noise' => '37389',
237
			'FocalPlaneXResolution' => '37390',
237
			'FocalPlaneXResolution' => '37390',
238
			'FocalPlaneYResolution' => '37391',
238
			'FocalPlaneYResolution' => '37391',
239
			'FocalPlaneResolutionUnit' => '37392',
239
			'FocalPlaneResolutionUnit' => '37392',
240
			'ImageNumber' => '37393',
240
			'ImageNumber' => '37393',
241
			'SecurityClassification' => '37394',
241
			'SecurityClassification' => '37394',
242
			'ImageHistory' => '37395',
242
			'ImageHistory' => '37395',
243
			'SubjectArea' => '37396',
243
			'SubjectArea' => '37396',
244
			'ExposureIndex' => '37397',
244
			'ExposureIndex' => '37397',
245
			'TIFF-EPStandardID' => '37398',
245
			'TIFF-EPStandardID' => '37398',
246
			'SensingMethod' => '37399',
246
			'SensingMethod' => '37399',
247
			'CIP3DataFile' => '37434',
247
			'CIP3DataFile' => '37434',
248
			'CIP3Sheet' => '37435',
248
			'CIP3Sheet' => '37435',
249
			'CIP3Side' => '37436',
249
			'CIP3Side' => '37436',
250
			'StoNits' => '37439',
250
			'StoNits' => '37439',
251
			'MakerNoteCanon' => '37500',
251
			'MakerNoteCanon' => '37500',
252
			'UserComment' => '37510',
252
			'UserComment' => '37510',
253
			'SubSecTime' => '37520',
253
			'SubSecTime' => '37520',
254
			'SubSecTimeOriginal' => '37521',
254
			'SubSecTimeOriginal' => '37521',
255
			'SubSecTimeDigitized' => '37522',
255
			'SubSecTimeDigitized' => '37522',
256
			'MSDocumentText' => '37679',
256
			'MSDocumentText' => '37679',
257
			'MSPropertySetStorage' => '37680',
257
			'MSPropertySetStorage' => '37680',
258
			'MSDocumentTextPosition' => '37681',
258
			'MSDocumentTextPosition' => '37681',
259
			'ImageSourceData' => '37724',
259
			'ImageSourceData' => '37724',
260
			'XPTitle' => '40091',
260
			'XPTitle' => '40091',
261
			'XPComment' => '40092',
261
			'XPComment' => '40092',
262
			'XPAuthor' => '40093',
262
			'XPAuthor' => '40093',
263
			'XPKeywords' => '40094',
263
			'XPKeywords' => '40094',
264
			'XPSubject' => '40095',
264
			'XPSubject' => '40095',
265
			'FlashpixVersion' => '40960',
265
			'FlashpixVersion' => '40960',
266
			'ColorSpace' => '40961',
266
			'ColorSpace' => '40961',
267
			'ExifImageWidth' => '40962',
267
			'ExifImageWidth' => '40962',
268
			'ExifImageHeight' => '40963',
268
			'ExifImageHeight' => '40963',
269
			'RelatedSoundFile' => '40964',
269
			'RelatedSoundFile' => '40964',
270
			'InteropOffset' => '40965',
270
			'InteropOffset' => '40965',
271
			'FlashEnergy' => '41483',
271
			'FlashEnergy' => '41483',
272
			'SpatialFrequencyResponse' => '41484',
272
			'SpatialFrequencyResponse' => '41484',
273
			'Noise' => '41485',
273
			'Noise' => '41485',
274
			'FocalPlaneXResolution' => '41486',
274
			'FocalPlaneXResolution' => '41486',
275
			'FocalPlaneYResolution' => '41487',
275
			'FocalPlaneYResolution' => '41487',
276
			'FocalPlaneResolutionUnit' => '41488',
276
			'FocalPlaneResolutionUnit' => '41488',
277
			'ImageNumber' => '41489',
277
			'ImageNumber' => '41489',
278
			'SecurityClassification' => '41490',
278
			'SecurityClassification' => '41490',
279
			'ImageHistory' => '41491',
279
			'ImageHistory' => '41491',
280
			'SubjectLocation' => '41492',
280
			'SubjectLocation' => '41492',
281
			'ExposureIndex' => '41493',
281
			'ExposureIndex' => '41493',
282
			'TIFF-EPStandardID' => '41494',
282
			'TIFF-EPStandardID' => '41494',
283
			'SensingMethod' => '41495',
283
			'SensingMethod' => '41495',
284
			'FileSource' => '41728',
284
			'FileSource' => '41728',
285
			'SceneType' => '41729',
285
			'SceneType' => '41729',
286
			'CFAPattern' => '41730',
286
			'CFAPattern' => '41730',
287
			'CustomRendered' => '41985',
287
			'CustomRendered' => '41985',
288
			'ExposureMode' => '41986',
288
			'ExposureMode' => '41986',
289
			'WhiteBalance' => '41987',
289
			'WhiteBalance' => '41987',
290
			'DigitalZoomRatio' => '41988',
290
			'DigitalZoomRatio' => '41988',
291
			'FocalLengthIn35mmFormat' => '41989',
291
			'FocalLengthIn35mmFormat' => '41989',
292
			'SceneCaptureType' => '41990',
292
			'SceneCaptureType' => '41990',
293
			'GainControl' => '41991',
293
			'GainControl' => '41991',
294
			'Contrast' => '41992',
294
			'Contrast' => '41992',
295
			'Saturation' => '41993',
295
			'Saturation' => '41993',
296
			'Sharpness' => '41994',
296
			'Sharpness' => '41994',
297
			'DeviceSettingDescription' => '41995',
297
			'DeviceSettingDescription' => '41995',
298
			'SubjectDistanceRange' => '41996',
298
			'SubjectDistanceRange' => '41996',
299
			'ImageUniqueID' => '42016',
299
			'ImageUniqueID' => '42016',
300
			'OwnerName' => '42032',
300
			'OwnerName' => '42032',
301
			'SerialNumber' => '42033',
301
			'SerialNumber' => '42033',
302
			'LensInfo' => '42034',
302
			'LensInfo' => '42034',
303
			'LensMake' => '42035',
303
			'LensMake' => '42035',
304
			'LensModel' => '42036',
304
			'LensModel' => '42036',
305
			'LensSerialNumber' => '42037',
305
			'LensSerialNumber' => '42037',
306
			'GDALMetadata' => '42112',
306
			'GDALMetadata' => '42112',
307
			'GDALNoData' => '42113',
307
			'GDALNoData' => '42113',
308
			'Gamma' => '42240',
308
			'Gamma' => '42240',
309
			'ExpandSoftware' => '44992',
309
			'ExpandSoftware' => '44992',
310
			'ExpandLens' => '44993',
310
			'ExpandLens' => '44993',
311
			'ExpandFilm' => '44994',
311
			'ExpandFilm' => '44994',
312
			'ExpandFilterLens' => '44995',
312
			'ExpandFilterLens' => '44995',
313
			'ExpandScanner' => '44996',
313
			'ExpandScanner' => '44996',
314
			'ExpandFlashLamp' => '44997',
314
			'ExpandFlashLamp' => '44997',
315
			'PixelFormat' => '48129',
315
			'PixelFormat' => '48129',
316
			'Transformation' => '48130',
316
			'Transformation' => '48130',
317
			'Uncompressed' => '48131',
317
			'Uncompressed' => '48131',
318
			'ImageType' => '48132',
318
			'ImageType' => '48132',
319
			'ImageWidth' => '48256',
319
			'ImageWidth' => '48256',
320
			'ImageHeight' => '48257',
320
			'ImageHeight' => '48257',
321
			'WidthResolution' => '48258',
321
			'WidthResolution' => '48258',
322
			'HeightResolution' => '48259',
322
			'HeightResolution' => '48259',
323
			'ImageOffset' => '48320',
323
			'ImageOffset' => '48320',
324
			'ImageByteCount' => '48321',
324
			'ImageByteCount' => '48321',
325
			'AlphaOffset' => '48322',
325
			'AlphaOffset' => '48322',
326
			'AlphaByteCount' => '48323',
326
			'AlphaByteCount' => '48323',
327
			'ImageDataDiscard' => '48324',
327
			'ImageDataDiscard' => '48324',
328
			'AlphaDataDiscard' => '48325',
328
			'AlphaDataDiscard' => '48325',
329
			'OceScanjobDesc' => '50215',
329
			'OceScanjobDesc' => '50215',
330
			'OceApplicationSelector' => '50216',
330
			'OceApplicationSelector' => '50216',
331
			'OceIDNumber' => '50217',
331
			'OceIDNumber' => '50217',
332
			'OceImageLogic' => '50218',
332
			'OceImageLogic' => '50218',
333
			'Annotations' => '50255',
333
			'Annotations' => '50255',
334
			'PrintIM' => '50341',
334
			'PrintIM' => '50341',
335
			'USPTOOriginalContentType' => '50560',
335
			'USPTOOriginalContentType' => '50560',
336
			'DNGVersion' => '50706',
336
			'DNGVersion' => '50706',
337
			'DNGBackwardVersion' => '50707',
337
			'DNGBackwardVersion' => '50707',
338
			'UniqueCameraModel' => '50708',
338
			'UniqueCameraModel' => '50708',
339
			'LocalizedCameraModel' => '50709',
339
			'LocalizedCameraModel' => '50709',
340
			'CFAPlaneColor' => '50710',
340
			'CFAPlaneColor' => '50710',
341
			'CFALayout' => '50711',
341
			'CFALayout' => '50711',
342
			'LinearizationTable' => '50712',
342
			'LinearizationTable' => '50712',
343
			'BlackLevelRepeatDim' => '50713',
343
			'BlackLevelRepeatDim' => '50713',
344
			'BlackLevel' => '50714',
344
			'BlackLevel' => '50714',
345
			'BlackLevelDeltaH' => '50715',
345
			'BlackLevelDeltaH' => '50715',
346
			'BlackLevelDeltaV' => '50716',
346
			'BlackLevelDeltaV' => '50716',
347
			'WhiteLevel' => '50717',
347
			'WhiteLevel' => '50717',
348
			'DefaultScale' => '50718',
348
			'DefaultScale' => '50718',
349
			'DefaultCropOrigin' => '50719',
349
			'DefaultCropOrigin' => '50719',
350
			'DefaultCropSize' => '50720',
350
			'DefaultCropSize' => '50720',
351
			'ColorMatrix1' => '50721',
351
			'ColorMatrix1' => '50721',
352
			'ColorMatrix2' => '50722',
352
			'ColorMatrix2' => '50722',
353
			'CameraCalibration1' => '50723',
353
			'CameraCalibration1' => '50723',
354
			'CameraCalibration2' => '50724',
354
			'CameraCalibration2' => '50724',
355
			'ReductionMatrix1' => '50725',
355
			'ReductionMatrix1' => '50725',
356
			'ReductionMatrix2' => '50726',
356
			'ReductionMatrix2' => '50726',
357
			'AnalogBalance' => '50727',
357
			'AnalogBalance' => '50727',
358
			'AsShotNeutral' => '50728',
358
			'AsShotNeutral' => '50728',
359
			'AsShotWhiteXY' => '50729',
359
			'AsShotWhiteXY' => '50729',
360
			'BaselineExposure' => '50730',
360
			'BaselineExposure' => '50730',
361
			'BaselineNoise' => '50731',
361
			'BaselineNoise' => '50731',
362
			'BaselineSharpness' => '50732',
362
			'BaselineSharpness' => '50732',
363
			'BayerGreenSplit' => '50733',
363
			'BayerGreenSplit' => '50733',
364
			'LinearResponseLimit' => '50734',
364
			'LinearResponseLimit' => '50734',
365
			'CameraSerialNumber' => '50735',
365
			'CameraSerialNumber' => '50735',
366
			'DNGLensInfo' => '50736',
366
			'DNGLensInfo' => '50736',
367
			'ChromaBlurRadius' => '50737',
367
			'ChromaBlurRadius' => '50737',
368
			'AntiAliasStrength' => '50738',
368
			'AntiAliasStrength' => '50738',
369
			'ShadowScale' => '50739',
369
			'ShadowScale' => '50739',
370
			'SR2Private' => '50740',
370
			'SR2Private' => '50740',
371
			'MakerNoteSafety' => '50741',
371
			'MakerNoteSafety' => '50741',
372
			'RawImageSegmentation' => '50752',
372
			'RawImageSegmentation' => '50752',
373
			'CalibrationIlluminant1' => '50778',
373
			'CalibrationIlluminant1' => '50778',
374
			'CalibrationIlluminant2' => '50779',
374
			'CalibrationIlluminant2' => '50779',
375
			'BestQualityScale' => '50780',
375
			'BestQualityScale' => '50780',
376
			'RawDataUniqueID' => '50781',
376
			'RawDataUniqueID' => '50781',
377
			'AliasLayerMetadata' => '50784',
377
			'AliasLayerMetadata' => '50784',
378
			'OriginalRawFileName' => '50827',
378
			'OriginalRawFileName' => '50827',
379
			'OriginalRawFileData' => '50828',
379
			'OriginalRawFileData' => '50828',
380
			'ActiveArea' => '50829',
380
			'ActiveArea' => '50829',
381
			'MaskedAreas' => '50830',
381
			'MaskedAreas' => '50830',
382
			'AsShotICCProfile' => '50831',
382
			'AsShotICCProfile' => '50831',
383
			'AsShotPreProfileMatrix' => '50832',
383
			'AsShotPreProfileMatrix' => '50832',
384
			'CurrentICCProfile' => '50833',
384
			'CurrentICCProfile' => '50833',
385
			'CurrentPreProfileMatrix' => '50834',
385
			'CurrentPreProfileMatrix' => '50834',
386
			'ColorimetricReference' => '50879',
386
			'ColorimetricReference' => '50879',
387
			'PanasonicTitle' => '50898',
387
			'PanasonicTitle' => '50898',
388
			'PanasonicTitle2' => '50899',
388
			'PanasonicTitle2' => '50899',
389
			'CameraCalibrationSig' => '50931',
389
			'CameraCalibrationSig' => '50931',
390
			'ProfileCalibrationSig' => '50932',
390
			'ProfileCalibrationSig' => '50932',
391
			'ProfileIFD' => '50933',
391
			'ProfileIFD' => '50933',
392
			'AsShotProfileName' => '50934',
392
			'AsShotProfileName' => '50934',
393
			'NoiseReductionApplied' => '50935',
393
			'NoiseReductionApplied' => '50935',
394
			'ProfileName' => '50936',
394
			'ProfileName' => '50936',
395
			'ProfileHueSatMapDims' => '50937',
395
			'ProfileHueSatMapDims' => '50937',
396
			'ProfileHueSatMapData1' => '50938',
396
			'ProfileHueSatMapData1' => '50938',
397
			'ProfileHueSatMapData2' => '50939',
397
			'ProfileHueSatMapData2' => '50939',
398
			'ProfileToneCurve' => '50940',
398
			'ProfileToneCurve' => '50940',
399
			'ProfileEmbedPolicy' => '50941',
399
			'ProfileEmbedPolicy' => '50941',
400
			'ProfileCopyright' => '50942',
400
			'ProfileCopyright' => '50942',
401
			'ForwardMatrix1' => '50964',
401
			'ForwardMatrix1' => '50964',
402
			'ForwardMatrix2' => '50965',
402
			'ForwardMatrix2' => '50965',
403
			'PreviewApplicationName' => '50966',
403
			'PreviewApplicationName' => '50966',
404
			'PreviewApplicationVersion' => '50967',
404
			'PreviewApplicationVersion' => '50967',
405
			'PreviewSettingsName' => '50968',
405
			'PreviewSettingsName' => '50968',
406
			'PreviewSettingsDigest' => '50969',
406
			'PreviewSettingsDigest' => '50969',
407
			'PreviewColorSpace' => '50970',
407
			'PreviewColorSpace' => '50970',
408
			'PreviewDateTime' => '50971',
408
			'PreviewDateTime' => '50971',
409
			'RawImageDigest' => '50972',
409
			'RawImageDigest' => '50972',
410
			'OriginalRawFileDigest' => '50973',
410
			'OriginalRawFileDigest' => '50973',
411
			'SubTileBlockSize' => '50974',
411
			'SubTileBlockSize' => '50974',
412
			'RowInterleaveFactor' => '50975',
412
			'RowInterleaveFactor' => '50975',
413
			'ProfileLookTableDims' => '50981',
413
			'ProfileLookTableDims' => '50981',
414
			'ProfileLookTableData' => '50982',
414
			'ProfileLookTableData' => '50982',
415
			'OpcodeList1' => '51008',
415
			'OpcodeList1' => '51008',
416
			'OpcodeList2' => '51009',
416
			'OpcodeList2' => '51009',
417
			'OpcodeList3' => '51022',
417
			'OpcodeList3' => '51022',
418
			'NoiseProfile' => '51041',
418
			'NoiseProfile' => '51041',
419
			'Padding' => '59932',
419
			'Padding' => '59932',
420
			'OffsetSchema' => '59933',
420
			'OffsetSchema' => '59933',
421
			'OwnerName' => '65000',
421
			'OwnerName' => '65000',
422
			'SerialNumber' => '65001',
422
			'SerialNumber' => '65001',
423
			'Lens' => '65002',
423
			'Lens' => '65002',
424
			'KDC_IFD' => '65024',
424
			'KDC_IFD' => '65024',
425
			'RawFile' => '65100',
425
			'RawFile' => '65100',
426
			'Converter' => '65101',
426
			'Converter' => '65101',
427
			'WhiteBalance' => '65102',
427
			'WhiteBalance' => '65102',
428
			'Exposure' => '65105',
428
			'Exposure' => '65105',
429
			'Shadows' => '65106',
429
			'Shadows' => '65106',
430
			'Brightness' => '65107',
430
			'Brightness' => '65107',
431
			'Contrast' => '65108',
431
			'Contrast' => '65108',
432
			'Saturation' => '65109',
432
			'Saturation' => '65109',
433
			'Sharpness' => '65110',
433
			'Sharpness' => '65110',
434
			'Smoothness' => '65111',
434
			'Smoothness' => '65111',
435
			'MoireFilter' => '65112',
435
			'MoireFilter' => '65112',
436
	);
436
	);
437
 
437
 
438
	public function extraireMetadonnees($cheminImage) {
438
	public function extraireMetadonnees($cheminImage) {
439
		if ($this->peutUtiliserExifTool()) {
439
		if ($this->peutUtiliserExifTool()) {
440
			$this->meta = $this->decoderMetadonneesExifTool($cheminImage);
440
			$this->meta = $this->decoderMetadonneesExifTool($cheminImage);
441
		} else {
441
		} else {
442
			$this->meta = $this->decoderMetadonneesBasique($cheminImage);
442
			$this->meta = $this->decoderMetadonneesBasique($cheminImage);
443
		}
443
		}
444
 
444
 
445
		$metadonnees = array();
445
		$metadonnees = array();
446
		$metadonnees['date_shot'] = $this->obtenirDatePriseDeVue() ?: (new DateTime())->format('Y-m-d H:i:s');
446
		$metadonnees['date_shot'] = $this->obtenirDatePriseDeVue() ?: null;
447
		$metadonnees['size'] = filesize($cheminImage);
447
		$metadonnees['size'] = filesize($cheminImage);
448
		return $metadonnees;
448
		return $metadonnees;
449
	}
449
	}
450
 
450
 
451
	private function peutUtiliserExifTool() {
451
	private function peutUtiliserExifTool() {
452
		// TODO indiquer ceci dans un fichier de config
452
		// TODO indiquer ceci dans un fichier de config
453
		return file_exists('/usr/bin/exiftool') && is_executable('/usr/bin/exiftool');
453
		return file_exists('/usr/bin/exiftool') && is_executable('/usr/bin/exiftool');
454
	}
454
	}
455
 
455
 
456
	private function decoderMetadonneesExifTool($cheminImage) {
456
	private function decoderMetadonneesExifTool($cheminImage) {
457
		$metadata = array();
457
		$metadata = array();
458
		$res = exec('/usr/bin/exiftool -g -D "'.$cheminImage.'"', $metadata);
458
		$res = exec('/usr/bin/exiftool -g -D "'.$cheminImage.'"', $metadata);
459
 
459
 
460
		$metadata_decodees = array();
460
		$metadata_decodees = array();
461
		$categorie = '';
461
		$categorie = '';
462
		foreach($metadata as &$data) {
462
		foreach($metadata as &$data) {
463
			if ($this->estUnSeparateurCategorieExifTool($data)) {
463
			if ($this->estUnSeparateurCategorieExifTool($data)) {
464
				$categorie = trim(str_replace('----', '', $data));
464
				$categorie = trim(str_replace('----', '', $data));
465
			} else {
465
			} else {
466
				$data_decodee = $this->parserValeurMetadonneeExifTool($data);
466
				$data_decodee = $this->parserValeurMetadonneeExifTool($data);
467
				$cle_metadonnee = str_replace(' ', '', $data_decodee['cle']);
467
				$cle_metadonnee = str_replace(' ', '', $data_decodee['cle']);
468
				$metadata_decodees[$categorie][$cle_metadonnee] = $data_decodee;
468
				$metadata_decodees[$categorie][$cle_metadonnee] = $data_decodee;
469
			}
469
			}
470
		}
470
		}
471
		return $metadata_decodees;
471
		return $metadata_decodees;
472
	}
472
	}
473
 
473
 
474
	private function estUnSeparateurCategorieExifTool($data) {
474
	private function estUnSeparateurCategorieExifTool($data) {
475
		return preg_match('^---- (.)* ----^',$data);
475
		return preg_match('^---- (.)* ----^',$data);
476
	}
476
	}
477
 
477
 
478
	private function parserValeurMetadonneeExifTool($data) {
478
	private function parserValeurMetadonneeExifTool($data) {
479
		$cle_valeur = explode(':',$data,2);
479
		$cle_valeur = explode(':',$data,2);
480
 
480
 
481
		$valeur = '';
481
		$valeur = '';
482
		if(count($cle_valeur) == 2) {
482
		if(count($cle_valeur) == 2) {
483
			$valeur	= trim($cle_valeur[1]);
483
			$valeur	= trim($cle_valeur[1]);
484
		}
484
		}
485
 
485
 
486
		$id_cle = explode(' ',trim($cle_valeur[0]),2);
486
		$id_cle = explode(' ',trim($cle_valeur[0]),2);
487
 
487
 
488
		$id_cle[1] = str_replace(array('-','/'),'',$id_cle[1]);
488
		$id_cle[1] = str_replace(array('-','/'),'',$id_cle[1]);
489
 
489
 
490
		$cle_id_valeur = array('cle' => $id_cle[1], 'id' => str_replace('-','',$id_cle[0]), 'valeur' => $valeur);
490
		$cle_id_valeur = array('cle' => $id_cle[1], 'id' => str_replace('-','',$id_cle[0]), 'valeur' => $valeur);
491
		return $cle_id_valeur;
491
		return $cle_id_valeur;
492
	}
492
	}
493
 
493
 
494
	public function decoderMetadonneesBasique($chemin_fichier) {
494
	public function decoderMetadonneesBasique($chemin_fichier) {
495
		$exif = @exif_read_data($chemin_fichier, "EXIF,COMPUTED,IFD0,FILE,COMMENT", true, false);
495
		$exif = @exif_read_data($chemin_fichier, "EXIF,COMPUTED,IFD0,FILE,COMMENT", true, false);
496
 
496
 
497
		// tant pis pour les makernote et xmp, les décoder demande trop de librairies externes, autant installer exiftool alors
497
		// tant pis pour les makernote et xmp, les décoder demande trop de librairies externes, autant installer exiftool alors
498
		$metadonnees = array();
498
		$metadonnees = array();
499
		$metadonnees['XMP'] = array();
499
		$metadonnees['XMP'] = array();
500
		unset($metadonnees['EXIF']['MakerNote']);
500
		unset($metadonnees['EXIF']['MakerNote']);
501
		$metadonnees['MAKERNOTE'] = array();
501
		$metadonnees['MAKERNOTE'] = array();
502
		$metadonnees_non_formatees = array();
502
		$metadonnees_non_formatees = array();
503
		if(isset($exif['EXIF'])) {
503
		if(isset($exif['EXIF'])) {
504
			$metadonnees_non_formatees = array_merge($metadonnees_non_formatees, $exif['EXIF']);
504
			$metadonnees_non_formatees = array_merge($metadonnees_non_formatees, $exif['EXIF']);
505
		}
505
		}
506
		if(isset($exif['IFD0'])) {
506
		if(isset($exif['IFD0'])) {
507
			$metadonnees_non_formatees = array_merge($metadonnees_non_formatees, $exif['IFD0']);
507
			$metadonnees_non_formatees = array_merge($metadonnees_non_formatees, $exif['IFD0']);
508
		}
508
		}
509
		$metadonnees['EXIF'] = $this->formaterTableauExif($metadonnees_non_formatees);
509
		$metadonnees['EXIF'] = $this->formaterTableauExif($metadonnees_non_formatees);
510
		$metadonnees['IPTC'] = $this->extraireIptc($chemin_fichier);
510
		$metadonnees['IPTC'] = $this->extraireIptc($chemin_fichier);
511
		$metadonnees['File'] = array(
511
		$metadonnees['File'] = array(
512
			'ImageWidth' => array('id' => '', 'valeur' => $exif['COMPUTED']['Width']),
512
			'ImageWidth' => array('id' => '', 'valeur' => $exif['COMPUTED']['Width']),
513
			'ImageHeight' => array('id' => '', 'valeur' => $exif['COMPUTED']['Height']));
513
			'ImageHeight' => array('id' => '', 'valeur' => $exif['COMPUTED']['Height']));
514
		return $metadonnees ;
514
		return $metadonnees ;
515
	}
515
	}
516
 
516
 
517
 
517
 
518
 
518
 
519
 
519
 
520
	private function obtenirDatePriseDeVue() {
520
	private function obtenirDatePriseDeVue() {
521
		$date = isset($this->meta['EXIF']['DateTimeOriginal']) ? $this->meta['EXIF']['DateTimeOriginal']['valeur'] : '';
521
		$date = isset($this->meta['EXIF']['DateTimeOriginal']) ? $this->meta['EXIF']['DateTimeOriginal']['valeur'] : '';
522
		return $date;
522
		return $date;
523
	}
523
	}
524
 
-
 
525
}
524
 
-
 
525
}