Changeset 6729 for extensions/AMetaData/JpegMetaData/JpegMetaData.class.php
- Timestamp:
- Jul 29, 2010, 10:12:25 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMetaData/JpegMetaData/JpegMetaData.class.php
r6722 r6729 4 4 * 5 5 * Version : 1.0.1 6 * Date : 2010-07-2 46 * Date : 2010-07-29 7 7 * 8 8 * Author : Grum … … 41 41 * | 1.0.0 | | * first public release 42 42 * | | | 43 * | 1.0.1 | 2010-07-2 4| * mantis bug:168643 * | 1.0.1 | 2010-07-29 | * mantis bug:1686 44 44 * | | | . bug reported on IfdReader 45 45 * | | | When sub IFD (0x8769) refers to a sub IFD with … … 50 50 * | | | (right solution: to be able to read negative 51 51 * | | | offset) 52 * | | | 52 53 * | | | * mantis feature : 1719 53 54 * | | | . Coding a DateTime class ; used only if there is 54 55 * | | | no PHP built-in DateTime class 56 * | | | 57 * | | | * add the "schema" property to Tag class 58 * | | | 59 * | | | * fixed bug about filtering schema 60 * | | | . when loading metadata, filter on schema are now 61 * | | | applied ; 'magic' metadata are computed even if 62 * | | | the other schema are filtered 63 * | | | 64 * | | | 65 * | | | 66 * | | | 55 67 * | | | 56 68 * | | | … … 133 145 const TAGFILTER_IMPLEMENTED = 0x02; 134 146 const TAGFILTER_ALL = 0x03; 135 136 const KEY_EXIF_TIFF = "exif.tiff";137 const KEY_EXIF_EXIF = "exif.exif";138 const KEY_EXIF_GPS = "exif.gps";139 const KEY_EXIF = "exif";140 const KEY_IPTC = "iptc";141 const KEY_XMP = "xmp";142 const KEY_MAGIC = "magic";143 147 144 148 private $jpeg = null; … … 238 242 case "exif": 239 243 $tmp=new IfdTags(); 240 $schema= "exif";244 $schema=Schemas::EXIF; 241 245 break; 242 246 case "gps": 243 247 $tmp=new GpsTags(); 244 $schema= "exif.gps";248 $schema=Schemas::EXIF_GPS; 245 249 break; 246 250 case "iptc": 247 251 $tmp=new IptcTags(); 248 $schema= "iptc";252 $schema=Schemas::IPTC; 249 253 break; 250 254 case "xmp": 251 255 $tmp=new XmpTags(); 252 $schema= "xmp";256 $schema=Schemas::XMP; 253 257 break; 254 258 case "magic": 255 259 $tmp=new MagicTags(); 256 $schema= "magic";260 $schema=Schemas::MAGIC; 257 261 break; 258 262 case MAKER_PENTAX: 259 263 include_once(JPEG_METADATA_DIR."TagDefinitions/PentaxTags.class.php"); 260 264 $tmp=new PentaxTags(); 261 $schema= "exif.".MAKER_PENTAX;265 $schema=Schemas::EXIF_MAKER.'.'.MAKER_PENTAX; 262 266 break; 263 267 case MAKER_NIKON: 264 268 include_once(JPEG_METADATA_DIR."TagDefinitions/NikonTags.class.php"); 265 269 $tmp=new NikonTags(); 266 $schema= "exif.".MAKER_NIKON;270 $schema=Schemas::EXIF_MAKER.'.'.MAKER_NIKON; 267 271 break; 268 272 case MAKER_CANON: 269 273 include_once(JPEG_METADATA_DIR."TagDefinitions/CanonTags.class.php"); 270 274 $tmp=new CanonTags(); 271 $schema= "exif.".MAKER_CANON;275 $schema=Schemas::EXIF_MAKER.'.'.MAKER_CANON; 272 276 break; 273 277 default: … … 287 291 $name=$key; 288 292 289 if(array_key_exists('schema', $tag) and $val== "exif")293 if(array_key_exists('schema', $tag) and $val==Schemas::EXIF) 290 294 $subSchema=".".$tag['schema']; 291 295 else 292 296 $subSchema=""; 293 297 294 if($val== 'xmp')298 if($val==Schemas::XMP) 295 299 $keyName=$schema.$subSchema.".".$key; 296 300 else … … 405 409 * Load Exifs tags from Tiff block 406 410 */ 407 if($data->getNbIFDs()>0) 411 if($data->getNbIFDs()>0 and 412 ($this->options['magic'] or $this->options['exif'] or $this->options['maker'])) 408 413 { 409 $this->loadIfdTags($data->getIFD(0), self::KEY_EXIF_TIFF);414 $this->loadIfdTags($data->getIFD(0), Schemas::EXIF_TIFF); 410 415 } 411 416 } … … 415 420 * Load Xmp tags from Xmp block 416 421 */ 417 $this->loadTags($data->getTags(), self::KEY_XMP); 422 if($this->options['magic'] or $this->options['xmp']) 423 { 424 $this->loadTags($data->getTags(), Schemas::XMP); 425 } 418 426 } 419 427 elseif($data instanceof IptcReader) … … 425 433 $data->optimizeDateTime(); 426 434 427 $this->loadTags($data->getTags(), self::KEY_IPTC); 435 if($this->options['magic'] or $this->options['iptc']) 436 { 437 $this->loadTags($data->getTags(), Schemas::IPTC); 438 } 428 439 } 429 440 } … … 433 444 { 434 445 $this->processMagicTags(); 446 } 447 448 // clean all unwanted metadata 449 foreach($this->tags as $key => $tag) 450 { 451 if(!$this->options[$tag->getSchema()]) unset($this->tags[$key]); 435 452 } 436 453 … … 543 560 { 544 561 case 'Exif IFD Pointer': 545 $exifKey2= self::KEY_EXIF_EXIF;562 $exifKey2=Schemas::EXIF_EXIF; 546 563 break; 547 564 case 'MakerNote': 548 $exifKey2= self::KEY_EXIF.".".$tag->getTag()->getLabel()->getMaker();565 $exifKey2=Schemas::EXIF_MAKER.".".$tag->getTag()->getLabel()->getMaker(); 549 566 break; 550 567 case 'GPS IFD Pointer': 551 $exifKey2= self::KEY_EXIF_GPS;568 $exifKey2=Schemas::EXIF_GPS; 552 569 break; 553 570 default: … … 621 638 $tag->setImplemented($val['implemented']); 622 639 $tag->setTranslatable($val['translatable']); 640 $tag->setSchema(Schemas::MAGIC); 623 641 624 642 $i=count($val['tagValues']);
Note: See TracChangeset
for help on using the changeset viewer.