Index: /extensions/AMetaData/JpegMetaData/Common/Const.class.php
===================================================================
--- /extensions/AMetaData/JpegMetaData/Common/Const.class.php	(revision 7510)
+++ /extensions/AMetaData/JpegMetaData/Common/Const.class.php	(revision 7511)
@@ -147,4 +147,5 @@
     const XMP   = "xmp";
     const MAGIC = "magic";
+    const COM   = "com";
 
     const EXIF_TIFF = "exif.tiff";
Index: /extensions/AMetaData/JpegMetaData/JpegMetaData.class.php
===================================================================
--- /extensions/AMetaData/JpegMetaData/JpegMetaData.class.php	(revision 7510)
+++ /extensions/AMetaData/JpegMetaData/JpegMetaData.class.php	(revision 7511)
@@ -101,7 +101,9 @@
  * |         |            |   . add XML <lr:hierarchicalSubject> markup
  * |         |            |
- * |         |            |
- * |         |            |
- * |         |            |
+ * |         |            | * mantis bug:1975
+ * |         |            |   . Implement COM segment as a tag
+ * |         |            |
+ * |         |            | * mantis bug:1976
+ * |         |            |   . Implement keywords as magic tag
  * |         |            |
  * |         |            |
@@ -242,4 +244,5 @@
         'maker' => true,
         'magic' => true,
+        'com'   => true
       );
 
@@ -275,4 +278,7 @@
         $list[]="magic";
 
+      if($default['com'])
+        $list[]="com";
+
       foreach($list as $val)
       {
@@ -300,4 +306,8 @@
             $tmp=new MagicTags();
             $schema=Schemas::MAGIC;
+            break;
+          case "com":
+            $tmp=new ComTags();
+            $schema=Schemas::COM;
             break;
           case MAKER_PENTAX:
@@ -479,4 +489,8 @@
               }
             }
+            elseif($data instanceof ComReader)
+            {
+              $this->loadTags($data->getTags(), Schemas::COM);
+            }
           }
         }
@@ -577,5 +591,6 @@
         'iptc'  => true,
         'xmp'   => true,
-        'magic' => true
+        'magic' => true,
+        'com'   => true
       );
 
@@ -676,5 +691,5 @@
           foreach($returned[1] as $testKey)
           {
-            $found=$found & array_key_exists($testKey, $this->tags);
+            $found=$found & (array_key_exists($testKey, $this->tags) and $this->tags[$testKey]->getValue()!='');
           }
           if(count($returned[1])==0) $found=false;
@@ -780,4 +795,9 @@
           if($result[4][0]=="W" or $result[4][0]=="S") $num=-$num;
           return($num);
+        case "Author.Keywords":
+          $list=array_flip(array_flip(explode(',', str_replace(array('/', '|', ', '), ',', $value))));
+          sort($list);
+          return(implode(',', $list));
+          break;
         default:
           return($value);
Index: /extensions/AMetaData/JpegMetaData/Locale/en_UK/Tag.po
===================================================================
--- /extensions/AMetaData/JpegMetaData/Locale/en_UK/Tag.po	(revision 7510)
+++ /extensions/AMetaData/JpegMetaData/Locale/en_UK/Tag.po	(revision 7511)
@@ -3,5 +3,5 @@
 "Project-Id-Version: TagNames\n"
 "POT-Creation-Date: \n"
-"PO-Revision-Date: 2010-04-11 09:31+0100\n"
+"PO-Revision-Date: 2010-10-31 01:25+0100\n"
 "Last-Translator: grum <grum@piwigo.org>\n"
 "Language-Team: grum\n"
@@ -285,4 +285,8 @@
 msgid "Author.ImageTitle"
 msgstr "Title"
+
+#. [Metadata name] Magic JpegMetadata computed tags / Author.Keywords
+msgid "Author.Keywords"
+msgstr "Keywords/Subject"
 
 #. Canon specific tags / 0x0001.4 (CanonCameraSettings.CanonFlashMode)
@@ -6412,2 +6416,30 @@
 msgstr "Y resolution"
 
+#. [Metadata name] XMP tags / digiKam:TagsList
+msgid "digiKam:TagsList"
+msgstr "Keywords/Subject"
+
+#. [Metadata name] XMP tags / lr:hierarchicalSubject
+msgid "lr:hierarchicalSubject"
+msgstr "Keywords/Subject"
+
+#. [Metadata name] IPTC tags / 0x20c04 (Subject Reference[Detail Name])
+msgid "Subject Reference[Detail Name]"
+msgstr "Subject Reference (Detail name)"
+
+#. [Metadata name] IPTC tags / 0x20c00 (Subject Reference[IPR])
+msgid "Subject Reference[IPR]"
+msgstr "Subject Reference (IPR)"
+
+#. [Metadata name] IPTC tags / 0x20c03 (Subject Reference[Matter Name])
+msgid "Subject Reference[Matter Name]"
+msgstr "Subject Reference (Matter Name)"
+
+#. [Metadata name] IPTC tags / 0x20c02 (Subject Reference[Name])
+msgid "Subject Reference[Name]"
+msgstr "Subject Reference (Name)"
+
+#. [Metadata name] IPTC tags / 0x20c01 (Subject Reference[Number])
+msgid "Subject Reference[Number]"
+msgstr "Subject Reference (Number)"
+
Index: /extensions/AMetaData/JpegMetaData/Locale/fr_FR/Tag.po
===================================================================
--- /extensions/AMetaData/JpegMetaData/Locale/fr_FR/Tag.po	(revision 7510)
+++ /extensions/AMetaData/JpegMetaData/Locale/fr_FR/Tag.po	(revision 7511)
@@ -3,5 +3,5 @@
 "Project-Id-Version: TagNames\n"
 "POT-Creation-Date: \n"
-"PO-Revision-Date: 2010-04-11 10:00+0100\n"
+"PO-Revision-Date: 2010-10-31 01:13+0100\n"
 "Last-Translator: grum <grum@piwigo.org>\n"
 "Language-Team: grum\n"
@@ -289,4 +289,8 @@
 msgid "Author.ImageTitle"
 msgstr "Titre"
+
+#. [Metadata name] Magic JpegMetadata computed tags / Author.Keywords
+msgid "Author.Keywords"
+msgstr "Mots clefs"
 
 #. Canon specific tags / 0x0001.4 (CanonCameraSettings.CanonFlashMode)
@@ -6561,2 +6565,30 @@
 msgstr "Résolution Y"
 
+#. [Metadata name] XMP tags / digiKam:TagsList
+msgid "digiKam:TagsList"
+msgstr "Mots clefs"
+
+#. [Metadata name] XMP tags / lr:hierarchicalSubject
+msgid "lr:hierarchicalSubject"
+msgstr "Mots clefs"
+
+#. [Metadata name] IPTC tags / 0x20c04 (Subject Reference[Detail Name])
+msgid "Subject Reference[Detail Name]"
+msgstr "Sujet de référence (nom détaillé)"
+
+#. [Metadata name] IPTC tags / 0x20c00 (Subject Reference[IPR])
+msgid "Subject Reference[IPR]"
+msgstr "Sujet de référence (IPR)"
+
+#. [Metadata name] IPTC tags / 0x20c03 (Subject Reference[Matter Name])
+msgid "Subject Reference[Matter Name]"
+msgstr "Sujet de référence (matière)"
+
+#. [Metadata name] IPTC tags / 0x20c02 (Subject Reference[Name])
+msgid "Subject Reference[Name]"
+msgstr "Sujet de référence (nom)"
+
+#. [Metadata name] IPTC tags / 0x20c01 (Subject Reference[Number])
+msgid "Subject Reference[Number]"
+msgstr "Sujet de référence (numéro)"
+
Index: /extensions/AMetaData/JpegMetaData/Readers/AppMarkerSegmentReader.class.php
===================================================================
--- /extensions/AMetaData/JpegMetaData/Readers/AppMarkerSegmentReader.class.php	(revision 7510)
+++ /extensions/AMetaData/JpegMetaData/Readers/AppMarkerSegmentReader.class.php	(revision 7511)
@@ -73,4 +73,5 @@
   require_once(JPEG_METADATA_DIR."Readers/XmpReader.class.php");
   require_once(JPEG_METADATA_DIR."Readers/IptcReader.class.php");
+  require_once(JPEG_METADATA_DIR."Readers/ComReader.class.php");
 
   class AppMarkerSegmentReader
@@ -922,5 +923,5 @@
     private function readSegmentCOM()
     {
-      $this->data = $this->workData->readASCII();
+      $this->data = new ComReader($this->workData->readASCII());
       $this->dataLoaded=true;
     }
Index: /extensions/AMetaData/JpegMetaData/Readers/ComReader.class.php
===================================================================
--- /extensions/AMetaData/JpegMetaData/Readers/ComReader.class.php	(revision 7511)
+++ /extensions/AMetaData/JpegMetaData/Readers/ComReader.class.php	(revision 7511)
@@ -0,0 +1,102 @@
+<?php
+/*
+ * --:: JPEG MetaDatas ::-------------------------------------------------------
+ *
+ *  Author    : Grum
+ *   email    : grum at piwigo.org
+ *   website  : http://photos.grum.fr
+ *
+ *   << May the Little SpaceFrog be with you ! >>
+ *
+ *
+ * +-----------------------------------------------------------------------+
+ * | JpegMetaData - a PHP based Jpeg Metadata manager                      |
+ * +-----------------------------------------------------------------------+
+ * | Copyright(C) 2010  Grum - http://www.grum.fr                          |
+ * +-----------------------------------------------------------------------+
+ * | This program is free software; you can redistribute it and/or modify  |
+ * | it under the terms of the GNU General Public License as published by  |
+ * | the Free Software Foundation                                          |
+ * |                                                                       |
+ * | This program is distributed in the hope that it will be useful, but   |
+ * | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+ * | General Public License for more details.                              |
+ * |                                                                       |
+ * | You should have received a copy of the GNU General Public License     |
+ * | along with this program; if not, write to the Free Software           |
+ * | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+ * | USA.                                                                  |
+ * +-----------------------------------------------------------------------+
+ *
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * The ComReader class is the dedicated class to read the COM structure
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * .. Notes ..
+ *
+ *
+ * This class provides theses public functions :
+ *  - getComment
+ *
+ * -----------------------------------------------------------------------------
+ */
+
+  require_once(JPEG_METADATA_DIR."Common/Data.class.php");
+  require_once(JPEG_METADATA_DIR."TagDefinitions/ComTags.class.php");
+
+  class ComReader extends GenericReader
+  {
+    private $comment;
+    /**
+     * The constructor need the Com block datas (given as a Data object)
+     *
+     * @param Data $data :
+     */
+    function __construct($data)
+    {
+      parent::__construct($data);
+      $this->comment=$this->data->readASCII();
+      $this->tagDef = new ComTags();
+
+      $tag=$this->tagDef->getTagById('comment');
+
+      $entry=new Tag();
+      $entry->setKnown(true);
+      $entry->setName($tag['tagName']);
+      $entry->setImplemented($tag['implemented']);
+      $entry->setTranslatable($tag['translatable']);
+      $entry->setSchema($tag['schema']);
+      $entry->setValue($this->comment);
+      $entry->setLabel($this->comment);
+      $this->entries[]=$entry;
+    }
+
+    function __destruct()
+    {
+      unset($this->comment);
+      parent::__destruct();
+    }
+
+    /**
+     * return the comment value
+     *
+     * @return String
+     */
+    public function getComment()
+    {
+      return($this->comment);
+    }
+
+    public function toString()
+    {
+      $returned="COM block value: ".$this->comment;
+      return($returned);
+    }
+  }
+
+
+?>
Index: /extensions/AMetaData/JpegMetaData/TagDefinitions/ComTags.class.php
===================================================================
--- /extensions/AMetaData/JpegMetaData/TagDefinitions/ComTags.class.php	(revision 7511)
+++ /extensions/AMetaData/JpegMetaData/TagDefinitions/ComTags.class.php	(revision 7511)
@@ -0,0 +1,76 @@
+<?php
+/*
+ * --:: JPEG MetaDatas ::-------------------------------------------------------
+ *
+ *  Author    : Grum
+ *   email    : grum at piwigo.org
+ *   website  : http://photos.grum.fr
+ *
+ *   << May the Little SpaceFrog be with you ! >>
+ *
+ *
+ * +-----------------------------------------------------------------------+
+ * | JpegMetaData - a PHP based Jpeg Metadata manager                      |
+ * +-----------------------------------------------------------------------+
+ * | Copyright(C) 2010  Grum - http://www.grum.fr                          |
+ * +-----------------------------------------------------------------------+
+ * | This program is free software; you can redistribute it and/or modify  |
+ * | it under the terms of the GNU General Public License as published by  |
+ * | the Free Software Foundation                                          |
+ * |                                                                       |
+ * | This program is distributed in the hope that it will be useful, but   |
+ * | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+ * | General Public License for more details.                              |
+ * |                                                                       |
+ * | You should have received a copy of the GNU General Public License     |
+ * | along with this program; if not, write to the Free Software           |
+ * | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+ * | USA.                                                                  |
+ * +-----------------------------------------------------------------------+
+ *
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * The ComTags is the definition of the Tiff & Exif tags
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * .. Notes ..
+ *
+ * The ComTags class is derived from the KnownTags class.
+ *
+ * ======> See KnownTags.class.php to know more about the tag definitions <=====
+ *
+ */
+
+  require_once(JPEG_METADATA_DIR."TagDefinitions/KnownTags.class.php");
+
+  /**
+   * Define the tags for COM segment
+   */
+  class ComTags extends KnownTags
+  {
+    protected $label = "COM segment tags";
+    protected $tags = Array(
+      /*
+       * tags with defined values
+       */
+
+      // comment, tag 'comment'
+      'comment' => Array(
+        'tagName'     => "comment",
+        'schema'      => "com",
+        'translatable'=> false,
+        'implemented' => true
+      ), // < comment
+    );
+
+    function __destruct()
+    {
+      parent::__destruct();
+    }
+  }
+
+
+?>
Index: /extensions/AMetaData/JpegMetaData/TagDefinitions/MagicTags.class.php
===================================================================
--- /extensions/AMetaData/JpegMetaData/TagDefinitions/MagicTags.class.php	(revision 7510)
+++ /extensions/AMetaData/JpegMetaData/TagDefinitions/MagicTags.class.php	(revision 7511)
@@ -254,4 +254,13 @@
           "{iptc.Caption/Abstract}",
           "{exif.exif.UserComment}",
+          "{com.comment}"
+        )
+      ),
+
+      'Author.Keywords' => Array(
+        'implemented'  => true,
+        'translatable' => false,
+        'tagValues' => Array(
+          "{xmp.dc:subject[values]},{iptc.Keywords[values]},{xmp.digiKam:TagsList[values]},{xmp.lr:hierarchicalSubject[values]}"
         )
       ),
Index: /extensions/AMetaData/JpegMetaData/test/index.php
===================================================================
--- /extensions/AMetaData/JpegMetaData/test/index.php	(revision 7510)
+++ /extensions/AMetaData/JpegMetaData/test/index.php	(revision 7511)
@@ -74,5 +74,11 @@
      7 => "808000",
      8 => "800080",
-     9 => "808080");
+     9 => "808080",
+     10 => "6080F0",
+     11 => "F06080",
+     12 => "80F060",
+     13 => "8080FF",
+     14 => "80FF80",
+     15 => "FF8080" );
 
     $parser = xml_parser_create();
@@ -237,5 +243,5 @@
   $page.="<span style='font-family:monospace;'>";
 
-  $jpeg = new JpegReader($file);
+  $jpeg = new JpegReader($file, Array('filter' => JpegMetaData::TAGFILTER_ALL, 'xmp' => false, 'maker' => false, 'iptc' => false, 'exif' => false));
 
   $page2="JpegReader extraction<br>";
@@ -286,4 +292,13 @@
         }
       }
+      elseif($data instanceof ComReader)
+      {
+        foreach($data->getTags() as $key2 => $val2)
+        {
+          $page2.="<div style='color:#0000ff;font-weight:normal;margin-left:12px;'>";
+          $page2.=dump_tag($key2, $val2, "");
+          $page2.="</div>";
+        }
+      }
       elseif(is_array($data))
       {
@@ -303,12 +318,19 @@
   $page2.="<div style='font-family:monospace;'>JpegMetaData - tag from test file<br>";
   $page2.="<table style='border:1px solid #000000;width:100%;'>";
-  $page2.="<tr style='border-bottom:1x solid #000000;'><th>Key</th><th>Name</th><th>Value</th><th>Computed Value</th></tr>";
+  $page2.="<tr style='border-bottom:1x solid #000000;'><th>Schema</th><th>Key</th><th>Name</th><th>Value</th><th>Computed Value</th></tr>";
 
 
   $time=microtime(true);
-  $jpegmd = new JpegMetaData($file, Array(
-    'filter' => JpegMetaData::TAGFILTER_IMPLEMENTED,
-    'optimizeIptcDateTime' => true)
-  );
+  $jpegmd = new JpegMetaData($file,
+                              Array(
+                                'filter' => JpegMetaData::TAGFILTER_IMPLEMENTED,
+                                'xmp' => true,
+                                'maker' => true,
+                                'iptc' => true,
+                                'magic' => true,
+                                'exif' => true,
+                                'optimizeIptcDateTime' => true
+                              )
+                            );
   $time2=microtime(true);
 
@@ -332,5 +354,5 @@
     if(is_array($value))
       $value=print_r($value, true);
-    $page2.="<tr><td>".$key."</td><td>".L10n::get($val->getName())."</td><td>".$value."</td><td style='$style'>".$txt."</td></tr>";
+    $page2.="<tr><td>".$val->getSchema()."</td><td>".$key."</td><td>".L10n::get($val->getName())."</td><td>".$value."</td><td style='$style'>".$txt."</td></tr>";
     $i++;
   }
@@ -342,5 +364,14 @@
   $page2.="<table style='border:1px solid #000000;width:100%;'>";
   $page2.="<tr style='border-bottom:1x solid #000000;'><th>Key</th><th>Name</th><th>Implemented</th></tr>";
-  foreach(JpegMetaData::getTagList(Array('filter' => JpegMetaData::TAGFILTER_ALL, 'xmp' => true, 'maker' => true, 'iptc' => true)) as $key => $val)
+  foreach(JpegMetaData::getTagList(
+                                    Array(
+                                      'filter' => JpegMetaData::TAGFILTER_ALL,
+                                      'xmp' => true,
+                                      'maker' => true,
+                                      'iptc' => true,
+                                      'magic' => true,
+                                      'exif' => true,
+                                    )
+                                  ) as $key => $val)
   {
     $val['implemented']?$i++:$j++;
