Changeset 6949 for extensions/AMetaData


Ignore:
Timestamp:
Sep 16, 2010, 8:53:47 PM (14 years ago)
Author:
grum
Message:

JpegMetadata => Implement multiple IPTC keywords managements & manage ISO-8859-1 to UTF8 charset
bug:1859, bug:1861

Location:
extensions/AMetaData/JpegMetaData
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMetaData/JpegMetaData/JpegMetaData.class.php

    r6889 r6949  
    6666 * | 1.1.1   | 2010-09-13 | * mantis bug:1826
    6767 * |         |            |   . digiKam XMP tags are not recognized
     68 * |         |            |
     69 * |         |            | * mantis bug:1859
     70 * |         |            |   . JpegMetadata class can't manage multiple IPTC
     71 * |         |            |     keywords
     72 * |         |            |
     73 * |         |            | * mantis bug:1861
     74 * |         |            |   . Accentued chars from ISO-8859-1 charset are not
     75 * |         |            |     recognized
    6876 * |         |            |
    6977 * |         |            |
  • extensions/AMetaData/JpegMetaData/Readers/IptcReader.class.php

    r6729 r6949  
    214214      unset($blocks);
    215215
     216
     217      /* for each entries, convert value to human readable tag value
     218       *
     219       * build a special 'keywords' tag made as an array from all iptc 'keywords' (0x0219) tags found
     220       */
     221      $keywordsTag=null;
    216222      foreach($this->entries as $key => $tag)
    217223      {
    218224        $this->setTagProperties($tag);
     225        if($tag->getId()==0x0219)
     226        {
     227          if(is_null($keywordsTag))
     228          {
     229            $keywordsTag=new Tag(
     230              0x0219,
     231              array($tag->getValue()),
     232              $tag->getName(),
     233              array($tag->getLabel()),
     234              "",
     235              $tag->isKnown(),
     236              $tag->isImplemented(),
     237              $tag->isTranslatable(),
     238              $tag->getSchema()
     239            );
     240          }
     241          else
     242          {
     243            $keywordsTag->setValue(array_merge($keywordsTag->getValue(), array($tag->getValue())));
     244            $keywordsTag->setLabel(array_merge($keywordsTag->getLabel(), array($tag->getLabel())));
     245          }
     246        }
     247      }
     248      if(!is_null($keywordsTag))
     249      {
     250        /*
     251         * IPTC 'keywords' is stored like XMP 'xmp.dc:subject' (as a 'seq')
     252         */
     253        $keywordsTag->setValue(
     254          array(
     255            'type' => 'seq',
     256            'values' => $keywordsTag->getValue()
     257          )
     258        );
     259
     260        $keywordsTag->setLabel(
     261          array(
     262            'type' => 'seq',
     263            'values' => $keywordsTag->getLabel()
     264          )
     265        );
     266        $this->entries[]=$keywordsTag;
     267        unset($keywordsTag);
    219268      }
    220269    }
     
    306355        case 0x027A: // 2:122 - Writer/Editor
    307356        case 0x0287: // 2:150 - Language Identifier
    308           $returned=$values;
     357          $returned=utf8_encode($values);
    309358          break;
    310359        case 0x0114: // 1:20  - File Format
Note: See TracChangeset for help on using the changeset viewer.