Index: extensions/AMetaData/JpegMetaData/Common/Const.class.php
===================================================================
--- extensions/AMetaData/JpegMetaData/Common/Const.class.php	(revision 6722)
+++ extensions/AMetaData/JpegMetaData/Common/Const.class.php	(revision 6729)
@@ -142,3 +142,15 @@
   }
 
+  class Schemas {
+    const EXIF  = "exif";
+    const IPTC  = "iptc";
+    const XMP   = "xmp";
+    const MAGIC = "magic";
+
+    const EXIF_TIFF = "exif.tiff";
+    const EXIF_EXIF = "exif.exif";
+    const EXIF_GPS  = "exif.gps";
+    const EXIF_MAKER  = "exif.maker";
+  }
+
 ?>
Index: extensions/AMetaData/JpegMetaData/Common/Tag.class.php
===================================================================
--- extensions/AMetaData/JpegMetaData/Common/Tag.class.php	(revision 6722)
+++ extensions/AMetaData/JpegMetaData/Common/Tag.class.php	(revision 6729)
@@ -45,5 +45,5 @@
  *  - tagValue          : the 'raw' value of the tag, not interpreted ; can be
  *                        of any type
- *  - valuelabel        : the interpreted value of the tag ; in most case it's a
+ *  - valueLabel        : the interpreted value of the tag ; in most case it's a
  *                        String, but can be an Integer, a Float or an Array
  *  - tagIsKnown        : indicates if the tag is a known tag or not
@@ -52,4 +52,5 @@
  *  - tagIsTranslatable : indicates if the interpreted value for the tag is
  *                        translatable
+ *  - schema            : the schema associated with the tag ('exif', 'iptc', 'xmp', 'magic')
  *
  * This class provides theses public functions :
@@ -59,4 +60,5 @@
  *  - getLabel
  *  - getNote
+ *  - getSchema
  *  - isKnown
  *  - isImplemented
@@ -67,4 +69,5 @@
  *  - setLabel
  *  - setNote
+ *  - setSchema
  *  - setKnown
  *  - setImplemented
@@ -84,4 +87,5 @@
     private $tagIsImplemented = false;
     private $tagIsTranslatable = false;
+    private $tagSchema = "";
 
     /**
@@ -104,7 +108,8 @@
      * @param Boolean $tagIstranslatable (optional) : determine if the tag value
      *                                                can be translated or not
-     *
-     */
-    function __construct($tagId=0xffff, $tagValue=0, $tagName="", $valueLabel="", $tagNote="", $tagIsKnown=false, $tagIsImplemented=false, $tagIsTranslatable=false)
+     * @param String $schema (optional)             : schema associated with to
+     *                                                the tag
+     */
+    function __construct($tagId=0xffff, $tagValue=0, $tagName="", $valueLabel="", $tagNote="", $tagIsKnown=false, $tagIsImplemented=false, $tagIsTranslatable=false, $schema="")
     {
       $this->tagId = $tagId;
@@ -116,4 +121,5 @@
       $this->tagIsImplemented=$tagIsImplemented;
       $this->tagIsTranslatable=$tagIsTranslatable;
+      $this->tagSchema = $schema;
     }
 
@@ -128,4 +134,5 @@
       unset($this->tagIsImplemented);
       unset($this->tagIsTranslatable);
+      unset($this->tagSchema);
     }
 
@@ -202,4 +209,14 @@
 
     /**
+     * returns the schema associated to the tag
+     *
+     * @return String
+     */
+    public function getSchema()
+    {
+      return($this->tagSchema);
+    }
+
+    /**
      * returns true if the tag value can be translated
      *
@@ -296,4 +313,17 @@
 
     /**
+     * set a schema to the tag
+     *
+     * @param String $value
+     * @return String
+     */
+    public function setSchema($value)
+    {
+      $this->tagSchema=$value;
+      return($this->tagSchema);
+    }
+
+
+    /**
      * set if the tag value is translatable
      *
@@ -313,5 +343,6 @@
       if($mode=="all")
         if(is_string($this->tagId))
-          $returned.="tag: ".str_replace(" ", "&nbsp;", sprintf("%-34s", $this->tagId))." ; ";
+          $returned.="tag: ".str_replace(" ", "&nbsp;", sprintf("%-34s", $this->tagId))." ;
+                      schema: ".str_replace(" ", "&nbsp;", sprintf("%-5s", $this->tagSchema))." ; ";
         else
           $returned.="tag: 0x".sprintf("%04x", $this->tagId)." ; ";
Index: extensions/AMetaData/JpegMetaData/JpegMetaData.class.php
===================================================================
--- extensions/AMetaData/JpegMetaData/JpegMetaData.class.php	(revision 6722)
+++ extensions/AMetaData/JpegMetaData/JpegMetaData.class.php	(revision 6729)
@@ -4,5 +4,5 @@
  *
  * Version : 1.0.1
- * Date    : 2010-07-24
+ * Date    : 2010-07-29
  *
  *  Author    : Grum
@@ -41,5 +41,5 @@
  * | 1.0.0   |            | * first public release
  * |         |            |
- * | 1.0.1   | 2010-07-24 | * mantis bug:1686
+ * | 1.0.1   | 2010-07-29 | * mantis bug:1686
  * |         |            |   . bug reported on IfdReader
  * |         |            |     When sub IFD (0x8769) refers to a sub IFD with
@@ -50,7 +50,19 @@
  * |         |            |     (right solution: to be able to read negative
  * |         |            |     offset)
+ * |         |            |
  * |         |            | * mantis feature : 1719
  * |         |            |   . Coding a DateTime class ; used only if there is
  * |         |            |     no PHP built-in DateTime class
+ * |         |            |
+ * |         |            | * add the "schema" property to Tag class
+ * |         |            |
+ * |         |            | * fixed bug about filtering schema
+ * |         |            |   . when loading metadata, filter on schema are now
+ * |         |            |     applied ; 'magic' metadata are computed even if
+ * |         |            |     the other schema are filtered
+ * |         |            |
+ * |         |            |
+ * |         |            |
+ * |         |            |
  * |         |            |
  * |         |            |
@@ -133,12 +145,4 @@
     const TAGFILTER_IMPLEMENTED = 0x02;
     const TAGFILTER_ALL         = 0x03;
-
-    const KEY_EXIF_TIFF = "exif.tiff";
-    const KEY_EXIF_EXIF = "exif.exif";
-    const KEY_EXIF_GPS  = "exif.gps";
-    const KEY_EXIF  = "exif";
-    const KEY_IPTC  = "iptc";
-    const KEY_XMP   = "xmp";
-    const KEY_MAGIC = "magic";
 
     private $jpeg = null;
@@ -238,36 +242,36 @@
           case "exif":
             $tmp=new IfdTags();
-            $schema="exif";
+            $schema=Schemas::EXIF;
             break;
           case "gps":
             $tmp=new GpsTags();
-            $schema="exif.gps";
+            $schema=Schemas::EXIF_GPS;
             break;
           case "iptc":
             $tmp=new IptcTags();
-            $schema="iptc";
+            $schema=Schemas::IPTC;
             break;
           case "xmp":
             $tmp=new XmpTags();
-            $schema="xmp";
+            $schema=Schemas::XMP;
             break;
           case "magic":
             $tmp=new MagicTags();
-            $schema="magic";
+            $schema=Schemas::MAGIC;
             break;
           case MAKER_PENTAX:
             include_once(JPEG_METADATA_DIR."TagDefinitions/PentaxTags.class.php");
             $tmp=new PentaxTags();
-            $schema="exif.".MAKER_PENTAX;
+            $schema=Schemas::EXIF_MAKER.'.'.MAKER_PENTAX;
             break;
           case MAKER_NIKON:
             include_once(JPEG_METADATA_DIR."TagDefinitions/NikonTags.class.php");
             $tmp=new NikonTags();
-            $schema="exif.".MAKER_NIKON;
+            $schema=Schemas::EXIF_MAKER.'.'.MAKER_NIKON;
             break;
           case MAKER_CANON:
             include_once(JPEG_METADATA_DIR."TagDefinitions/CanonTags.class.php");
             $tmp=new CanonTags();
-            $schema="exif.".MAKER_CANON;
+            $schema=Schemas::EXIF_MAKER.'.'.MAKER_CANON;
             break;
           default:
@@ -287,10 +291,10 @@
                 $name=$key;
 
-              if(array_key_exists('schema', $tag) and $val=="exif")
+              if(array_key_exists('schema', $tag) and $val==Schemas::EXIF)
                 $subSchema=".".$tag['schema'];
               else
                 $subSchema="";
 
-              if($val=='xmp')
+              if($val==Schemas::XMP)
                 $keyName=$schema.$subSchema.".".$key;
               else
@@ -405,7 +409,8 @@
                * Load Exifs tags from Tiff block
                */
-              if($data->getNbIFDs()>0)
+              if($data->getNbIFDs()>0 and
+                 ($this->options['magic'] or $this->options['exif'] or $this->options['maker']))
               {
-                $this->loadIfdTags($data->getIFD(0), self::KEY_EXIF_TIFF);
+                $this->loadIfdTags($data->getIFD(0), Schemas::EXIF_TIFF);
               }
             }
@@ -415,5 +420,8 @@
                * Load Xmp tags from Xmp block
                */
-              $this->loadTags($data->getTags(), self::KEY_XMP);
+              if($this->options['magic'] or $this->options['xmp'])
+              {
+                $this->loadTags($data->getTags(), Schemas::XMP);
+              }
             }
             elseif($data instanceof IptcReader)
@@ -425,5 +433,8 @@
                 $data->optimizeDateTime();
 
-              $this->loadTags($data->getTags(), self::KEY_IPTC);
+              if($this->options['magic'] or $this->options['iptc'])
+              {
+                $this->loadTags($data->getTags(), Schemas::IPTC);
+              }
             }
           }
@@ -433,4 +444,10 @@
         {
           $this->processMagicTags();
+        }
+
+        // clean all unwanted metadata
+        foreach($this->tags as $key => $tag)
+        {
+          if(!$this->options[$tag->getSchema()]) unset($this->tags[$key]);
         }
 
@@ -543,11 +560,11 @@
             {
               case 'Exif IFD Pointer':
-                $exifKey2=self::KEY_EXIF_EXIF;
+                $exifKey2=Schemas::EXIF_EXIF;
                 break;
               case 'MakerNote':
-                $exifKey2=self::KEY_EXIF.".".$tag->getTag()->getLabel()->getMaker();
+                $exifKey2=Schemas::EXIF_MAKER.".".$tag->getTag()->getLabel()->getMaker();
                 break;
               case 'GPS IFD Pointer':
-                $exifKey2=self::KEY_EXIF_GPS;
+                $exifKey2=Schemas::EXIF_GPS;
                 break;
               default:
@@ -621,4 +638,5 @@
             $tag->setImplemented($val['implemented']);
             $tag->setTranslatable($val['translatable']);
+            $tag->setSchema(Schemas::MAGIC);
 
             $i=count($val['tagValues']);
Index: extensions/AMetaData/JpegMetaData/Readers/CanonReader.class.php
===================================================================
--- extensions/AMetaData/JpegMetaData/Readers/CanonReader.class.php	(revision 6722)
+++ extensions/AMetaData/JpegMetaData/Readers/CanonReader.class.php	(revision 6729)
@@ -56,4 +56,6 @@
   class CanonReader extends MakerNotesReader
   {
+    protected $schema = Schemas::EXIF;
+
     /**
      * The constructor needs, like the ancestor, the datas to be parsed
@@ -187,4 +189,5 @@
           $entry->getTag()->setImplemented($tagDef['implemented']);
           $entry->getTag()->setTranslatable($tagDef['translatable']);
+          $entry->getTag()->setSchema($this->schema);
 
           if(array_key_exists('tagValues', $tagDef))
@@ -333,4 +336,5 @@
           $entry->getTag()->setImplemented($tagDef['implemented']);
           $entry->getTag()->setTranslatable($tagDef['translatable']);
+          $entry->getTag()->setSchema($this->schema);
 
           if(array_key_exists('tagValues', $tagDef))
@@ -509,4 +513,5 @@
           $entry->getTag()->setImplemented($subTagDef['implemented']);
           $entry->getTag()->setTranslatable($subTagDef['translatable']);
+          $entry->getTag()->setSchema($this->schema);
 
           if(array_key_exists('tagValues', $subTagDef))
@@ -598,4 +603,5 @@
           $entry->getTag()->setImplemented($subTagDef['implemented']);
           $entry->getTag()->setTranslatable($subTagDef['translatable']);
+          $entry->getTag()->setSchema($this->schema);
 
           if(array_key_exists('tagValues', $subTagDef))
Index: extensions/AMetaData/JpegMetaData/Readers/GpsReader.class.php
===================================================================
--- extensions/AMetaData/JpegMetaData/Readers/GpsReader.class.php	(revision 6722)
+++ extensions/AMetaData/JpegMetaData/Readers/GpsReader.class.php	(revision 6729)
@@ -54,4 +54,6 @@
   class GpsReader extends IfdReader
   {
+    protected $schema = Schemas::EXIF;
+
     function __destruct()
     {
Index: extensions/AMetaData/JpegMetaData/Readers/IfdReader.class.php
===================================================================
--- extensions/AMetaData/JpegMetaData/Readers/IfdReader.class.php	(revision 6722)
+++ extensions/AMetaData/JpegMetaData/Readers/IfdReader.class.php	(revision 6729)
@@ -81,8 +81,11 @@
   {
     protected $byteOrder = BYTE_ORDER_LITTLE_ENDIAN;
+    protected $schema = Schemas::EXIF;
+
 
     private $nextIFDOffset = 0;
 
     private $dataOffset = 0;
+
 
     /**
@@ -233,4 +236,5 @@
         $entry->getTag()->setImplemented($tag['implemented']);
         $entry->getTag()->setTranslatable($tag['translatable']);
+        $entry->getTag()->setSchema($this->schema);
 
         /*
Index: extensions/AMetaData/JpegMetaData/Readers/IptcReader.class.php
===================================================================
--- extensions/AMetaData/JpegMetaData/Readers/IptcReader.class.php	(revision 6722)
+++ extensions/AMetaData/JpegMetaData/Readers/IptcReader.class.php	(revision 6729)
@@ -65,4 +65,5 @@
     const HEADER_1 = "Photoshop 3.0\x00";
     const HEADER_2 = "Adobe_Photoshop2.5:\x00";
+    protected $schema = Schemas::IPTC;
 
     private $header = "";
@@ -237,4 +238,5 @@
         $tag->setImplemented($tagProperties['implemented']);
         $tag->setTranslatable($tagProperties['translatable']);
+        $tag->setSchema($this->schema);
 
         /*
Index: extensions/AMetaData/JpegMetaData/Readers/NikonReader.class.php
===================================================================
--- extensions/AMetaData/JpegMetaData/Readers/NikonReader.class.php	(revision 6722)
+++ extensions/AMetaData/JpegMetaData/Readers/NikonReader.class.php	(revision 6729)
@@ -59,4 +59,6 @@
   class NikonReader extends MakerNotesReader
   {
+    protected $schema = Schemas::EXIF;
+
     /* these 2 specific metadata are used to decrypt some information, like the
      * data lens
Index: extensions/AMetaData/JpegMetaData/Readers/PentaxReader.class.php
===================================================================
--- extensions/AMetaData/JpegMetaData/Readers/PentaxReader.class.php	(revision 6722)
+++ extensions/AMetaData/JpegMetaData/Readers/PentaxReader.class.php	(revision 6729)
@@ -60,4 +60,6 @@
   class PentaxReader extends MakerNotesReader
   {
+    protected $schema = Schemas::EXIF;
+
     /**
      * The constructor needs, like the ancestor, the datas to be parsed
Index: extensions/AMetaData/JpegMetaData/Readers/XmpReader.class.php
===================================================================
--- extensions/AMetaData/JpegMetaData/Readers/XmpReader.class.php	(revision 6722)
+++ extensions/AMetaData/JpegMetaData/Readers/XmpReader.class.php	(revision 6729)
@@ -53,4 +53,6 @@
   class XmpReader extends GenericReader
   {
+    protected $schema = Schemas::XMP;
+
     private $xmlData = NULL;
 
@@ -300,5 +302,5 @@
         $tag->setImplemented($tagProperties['implemented']);
         $tag->setTranslatable($tagProperties['translatable']);
-
+        $tag->setSchema($this->schema);
 
         if(array_key_exists('name', $tagProperties))
