Announcement

#16 2010-08-27 04:59:49

yuragal
Guest

Re: [plugin] Advanced Metadata

brough wrote:

kiddy-admin wrote:

and i have same problem - blank list only after activation the plugin

I have installed Grum Plugins Classes.3 Version 3.1.1 (also tried 3.1.0), and then installed Advanced MetaData  v 0.4. When I activate AMD I get a blank page.

Any ideas, anyone?

Have you guys built the metadata repository after installing AMedtadata plugin? This task could be accomplished through Plugin->Ametadata->Metadata. Then you should go to Repository tab, select a radio-button that best fits your need, and hit "Analyze".

HTH, Yuri.

 

#17 2010-08-27 05:17:45

yuragal
Guest

Re: [plugin] Advanced Metadata

plg wrote:

yuragal, you can do this with the standard IPTC configuration in Piwigo, please see [Forum, topic 8945] Reading IPTC tags and open a new topic if it doesn't answer your question.

I'm not sure whether "Tag list" tag comes from IPTC metadata group.

Furthermore, there is one more trick. Correct me if I'm wrong, but as far as I know, IPTC tags support ASCII characters only. So, I have to perform transliteration of Cyrillic symbols to ASCII. And this is what I don't want to do.

 

#18 2010-08-27 05:21:55

yuragal
Guest

Re: [plugin] Advanced Metadata

grum wrote:

Hi !

As you can see, the plugin Advanced Metadata is in the release 0.4 => I'm currently writting the release 0.5, but the possibility to import tags into piwigo will not be implemented before the release 0.6 because I don't have the time to do this...

Hi, Grum!

Thanks for reply. I'll wait till 0.6 release. Could you please announce expected date?

Best, Yuri.

 

#19 2010-08-27 10:18:17

grum
Former Piwigo Team
Pantin
2007-09-10
1371

Re: [plugin] Advanced Metadata

brough wrote:

kiddy-admin wrote:

and i have same problem - blank list only after activation the plugin

I have installed Grum Plugins Classes.3 Version 3.1.1 (also tried 3.1.0), and then installed Advanced MetaData  v 0.4. When I activate AMD I get a blank page. Have uninstalled and reinstalled using both manual and automated processes, same result.

Have tried it with both user 99 and actual owner. Same result: blank page when activated.

Piwigo version 2.1.2

Any ideas, anyone?

Can you check your PHP version ?
The 0.4 needs PHP >= 5.2.0 with th e gettext or the mbstring extensions activated.

Go to the "Administration Home" and "Show info"
In the PHP page search for "GetText Support" and "Multibyte Support"


My pictures with Piwigo, of course !
[ www.grum.fr ]

Offline

 

#20 2010-08-27 10:28:28

grum
Former Piwigo Team
Pantin
2007-09-10
1371

Re: [plugin] Advanced Metadata

yuragal wrote:

plg wrote:

yuragal, you can do this with the standard IPTC configuration in Piwigo, please see [Forum, topic 8945] Reading IPTC tags and open a new topic if it doesn't answer your question.

I'm not sure whether "Tag list" tag comes from IPTC metadata group.

Furthermore, there is one more trick. Correct me if I'm wrong, but as far as I know, IPTC tags support ASCII characters only. So, I have to perform transliteration of Cyrillic symbols to ASCII. And this is what I don't want to do.

Yes, you're right.
IPTC normally don't support the UTF8 encoding and you can have some problems when displaying data saved with other charset.
It seems that some tools can save them in UTF8, but I never try them.


About the release 0.5, I can't give you an expected date, so not abble to give a date for the 0.6 :-/

Can you send me a a picture with the expected "tag list" metadata ?


My pictures with Piwigo, of course !
[ www.grum.fr ]

Offline

 

#21 2010-08-27 11:19:48

brough
Member
2010-08-27
15

Re: [plugin] Advanced Metadata

grum wrote:

brough wrote:

kiddy-admin wrote:

and i have same problem - blank list only after activation the plugin

I have installed Grum Plugins Classes.3 Version 3.1.1 (also tried 3.1.0), and then installed Advanced MetaData  v 0.4. When I activate AMD I get a blank page. Have uninstalled and reinstalled using both manual and automated processes, same result.

Have tried it with both user 99 and actual owner. Same result: blank page when activated.

Piwigo version 2.1.2

Any ideas, anyone?

Can you check your PHP version ?
The 0.4 needs PHP >= 5.2.0 with th e gettext or the mbstring extensions activated.

Go to the "Administration Home" and "Show info"
In the PHP page search for "GetText Support" and "Multibyte Support"

Neither are installed. I'll post the results once I've got them running. Many thanks.

Offline

 

#22 2010-08-30 10:09:00

grum
Former Piwigo Team
Pantin
2007-09-10
1371

Re: [plugin] Advanced Metadata

grum wrote:

Can you send me a a picture with the expected "tag list" metadata ?

Ok, I've download the picture.

With a self-built tool, made with the core of AMD plugin, I can see that in the XMP metadata :

Code:

            dc:subject
               rdf:Bag
                  /rdf:li Хребет Кропоткина
                  /rdf:li водопад
               /rdf:Bag
            /dc:subject

            digiKam:TagsList
               rdf:Seq
                  /rdf:li места/Прибайкалье/Хребет Кропоткина
                  /rdf:li природа/ландшафт/водопад
               /rdf:Seq
            /digiKam:TagsList

I don't speek Russian, so can you tell me if there is 4 keyword, or only the first two are keywords ?


If the 2 last are keywords two, there is a little problem : tags are stored in an unconventionnal meta (the "digiKam:tagsList" is not defined in the XMP specifications) => I have opened the [Bugtracker] ticket 1826 to implement it

If you only want the 2 first (stored in the dc:subject meta), may be I can help you (I have to take a look, but I don't have the time before this night)


My pictures with Piwigo, of course !
[ www.grum.fr ]

Offline

 

#23 2010-08-30 10:43:58

brough
Member
2010-08-27
15

Re: [plugin] Advanced Metadata

brough wrote:

grum wrote:

brough wrote:


I have installed Grum Plugins Classes.3 Version 3.1.1 (also tried 3.1.0), and then installed Advanced MetaData  v 0.4. When I activate AMD I get a blank page. Have uninstalled and reinstalled using both manual and automated processes, same result.

Have tried it with both user 99 and actual owner. Same result: blank page when activated.

Piwigo version 2.1.2

Any ideas, anyone?

Can you check your PHP version ?
The 0.4 needs PHP >= 5.2.0 with th e gettext or the mbstring extensions activated.

Go to the "Administration Home" and "Show info"
In the PHP page search for "GetText Support" and "Multibyte Support"

Neither are installed. I'll post the results once I've got them running. Many thanks.

That fixed it. It was quite a job getting the server upgraded, but I'm sure it will be worth it. Many thanks!

Offline

 

#24 2010-08-30 13:20:02

yuragal
Translation Team
2010-08-30
5

Re: [plugin] Advanced Metadata

grum wrote:

If you only want the 2 first (stored in the dc:subject meta), may be I can help you (I have to take a look, but I don't have the time before this night)

Actually, the dc:subject container bears tags assigned to the image. Situation is complicated by the fact that DigiKam stores tags in a sort of hierarchical list where tags could be nested each other. In our example, each rdf:li is a path to the tag from a root of DigiKam tags tree, where node names concatenated by slashes.

Code:

               rdf:Seq
                  /rdf:li места/Прибайкалье/Хребет Кропоткина
                  /rdf:li природа/ландшафт/водопад
               /rdf:Seq

These tags recognized by exiftool as "Tags list" where all rdf:li entries are concatenated by commas:

Code:

$ exiftool IMG_5412.JPG
...
Tags List                       : места/Прибайкалье/Хребет Кропоткина, природа/ландшафт/водопад
...

So, for web-publishing I do need the dc:subject tags. I think it is quite a big challenge to write Digikam-like tag parser and to populate Digikam-like tag database. Furthermore, it could be wasteful effort as image metadata formats are not standardized to date. At least in my understanding.

Best, Yuri.

Last edited by yuragal (2010-08-30 13:44:25)

Offline

 

#25 2010-08-30 14:33:29

grum
Former Piwigo Team
Pantin
2007-09-10
1371

Re: [plugin] Advanced Metadata

Ok, I use digiKam to, but I don't use the tag management.
I think I understand what is the tags tree, but Piwigo can't manage tags in this way...

About this :

Code:

rdf:Seq
                  /rdf:li места/Прибайкалье/Хребет Кропоткина
                  /rdf:li природа/ландшафт/водопад
               /rdf:Seq

I think we can interpret it :
- as 6 tags (места, Прибайкалье, Хребет Кропоткина, природа, ландшафт, водопад)
or
- as 2 tags (Хребет Кропоткина, водопад)

It will not be difficult to write the code doing this, the most difficult part is to do a choice about how to interpret them into the piwigo tags system.
In all case, this feature will not be implemented before the release 0.6

To convert XMP dc:subject tags into piwigo tags, I take a look tonight to write a small tool (not possible to implement it quickly in the plugin)


My pictures with Piwigo, of course !
[ www.grum.fr ]

Offline

 

#26 2010-08-30 20:16:01

grum
Former Piwigo Team
Pantin
2007-09-10
1371

Re: [plugin] Advanced Metadata

Here you can find a script to import xmp.dc:subject tags from the AMD database into the piwigo's tags system.

1/ first, install the plugin [extension by Piwigo Team] LocalFiles Editor
2/ copy the code given below, and put it between the <?php     ?> in the personnal plugin tabs of the LocalFileEditor plugin
3/ save the personnal plugin, and activate it in the plugin manager
4/ check if everything is OK : just go to the http://your-adress-here/admin.php?importAmdTags=y url ; this url will not modify the database, it just display some information about the import
5/ if everything is OK, you go to the http://your-adress-here/admin.php?importAmdTags=y&checkOnly=n url ; this url will update the database

When everything is done, delete the personnal plugin (not a good idea to keep this one).




Code:

function importTag()
{
  if(!defined('IN_ADMIN')) return(false);

  if(isset($_REQUEST['importAmdTags']) and $_REQUEST['importAmdTags']=='y')
  {
    if(isset($_REQUEST['checkOnly']) and $_REQUEST['checkOnly']=='n')
    {
      xmpSubject2Tag(false);
    }
    else
    {
      xmpSubject2Tag(true);
    }

  }
}


function dumpNfo($nfo, $mode="")
{
  global $template;

  switch($mode)
  {
    case 'warning':
      $colors='font-weight:bold;color:#ffffff;background:#cc0000;';
      break;
    case 'info':
      $colors='font-weight:bold;color:#ffffff;background:#0000cc;';
      break;
    case 'ignore':
      $colors='font-weight:bold;color:#ffffff;background:#ff00ff;';
      break;
    default:
      $colors="";
  }

  echo "<span style='text-align:left;font-family:mono;$colors'>$nfo</span>";
}



function xmpSubject2Tag($checkOnly=true)
{
  $piwigoTagsExist=array();
  $existingTags=array();
  $piwigoTags=array();
  $tagList=array();
  $counter=array(
    'old' => 0,
    'new' => 0,
    'img' => 0,
    'ignore' => 0,
  );


  dumpNfo("---Start to build tag from XMP metadata---<br>");

  if($checkOnly)
  {
    dumpNfo("(!) build is in simulate mode, database will not be modified</span><br>", "warning");
  }

  // build a piwigo tags list
  $sql="SELECT id, name, url_name
        FROM ".TAGS_TABLE;
  $result=pwg_query($sql);
  if($result)
  {
    while($row=pwg_db_fetch_assoc($result))
    {
      $piwigoTags[$row['url_name']]=array(
        'id' => $row['id'],
        'name' => $row['name']
      );
    }
  }



  // build a tags list from xmp metadata
  $sql="SELECT imageId, value
        FROM piwigo_amd_images_tags  pait
        LEFT JOIN piwigo_amd_used_tags paut ON pait.numId = paut.numId
        WHERE paut.tagId='xmp.dc:subject'";
  $result=pwg_query($sql);
  if($result)
  {
    while($row=pwg_db_fetch_assoc($result))
    {
      $tmp=unserialize($row['value']);
      foreach($tmp['values'] as $tag)
      {
        $urlName=str2url($tag);
        if(array_key_exists($urlName, $tagList))
        {
          $tagList[$urlName]['images'][]=$row['imageId'];
        }
        else
        {
          $tagList[$urlName]=array(
            'id' => 0,
            'name' => $tag,
            'images' => array($row['imageId'])
          );
        }
      }
      $counter['img']++;
    }
  }






  // for each xmp tag found, check if already exist in the piwigo tags list
  // if not, insert the new tag and get the tag Id
  foreach($tagList as $key => $tag)
  {
    if(!array_key_exists($key, $piwigoTags))
    {
      $counter['new']++;
      dumpNfo("(i) Tag <b>".$tag['name']."</b> doesn't exist in Piwigo, create it ; Tag Id = ");

      if($checkOnly)
      {
        dumpNfo("--<br>");
      }
      else
      {
        $sql="INSERT INTO ".TAGS_TABLE." VALUES ('', '".addslashes($tag['name'])."', '".$key."')";
        $result=pwg_query($sql);
        if($result)
        {
          $tagList[$key]['id']=pwg_db_insert_id(TAGS_TABLE);
          dumpNfo($tagList[$key]['id']."<br>");
        }
        else
        {
          dumpNfo("failed to insert new tag id !<br>", "warning");
        }
      }
    }
    else
    {
      $counter['old']++;
      dumpNfo("(i) Tag <b>".$tag['name']."</b> already exist in Piwigo, don't create it<br>", "ignore");
      $tagList[$key]['id']=$piwigoTags[$key]['id'];
      $existingTags[]=$piwigoTags[$key]['id'];
    }
  }

  dumpNfo("(i) Tags found from XMP metadata :<br>", "info");
  dumpNfo("(i) - New created = ".$counter['new']."<br>", "info");
  dumpNfo("(i) - Already exists = ".$counter['old']."<br>", "info");
  dumpNfo("(i) - From pictures  = ".$counter['img']."<br>", "info");




  // build a piwigo picture-tags list with existing tags
  if(count($existingTags)>0)
  {
    $sql="SELECT image_id, tag_id
          FROM ".IMAGE_TAG_TABLE."
          WHERE tag_id in (".implode(',', $existingTags).")";
    $result=pwg_query($sql);
    if($result)
    {
      while($row=pwg_db_fetch_assoc($result))
      {
        $piwigoTagsExist[$row['image_id'].'-'.$row['tag_id']]='';
      }
    }
  }


  dumpNfo("Associating tags with images<br>");
  $inserts=array();
  // associate tags id to pictures
  foreach($tagList as $key => $tag)
  {
    foreach($tag['images'] as $imageId)
    {
      if(!array_key_exists($imageId.'-'.$tag['id'], $piwigoTagsExist) )
      {
        $inserts[]=array(
          'image_id' => $imageId,
          'tag_id' => $tag['id']
        );
        dumpNfo("(i) Tag <b>".$tag['id']."</b> (".$tag['name'].") is associated with picture <b>$imageId</b><br>");
      }
      else
      {
        dumpNfo("(i) Tag <b>".$tag['id']."</b> (".$tag['name'].") is already associated with picture <b>$imageId</b><br>", "ignore");
        $counter['ignore']++;
      }
    }
  }


  dumpNfo("(i) Associate tag with picture<br>", "info");
  dumpNfo("(i) - New = ".count($insert)."<br>", "info");
  dumpNfo("(i) - Ignored  = ".$counter['ignore']."<br>", "info");

  if(!$checkOnly and count($inserts))
  {
    mass_inserts(
      IMAGE_TAG_TABLE,
      array('image_id', 'tag_id'),
      $inserts
    );
  }

  dumpNfo("---Done---<br>");

}


 importTag();

Last edited by grum (2010-08-31 09:11:51)


My pictures with Piwigo, of course !
[ www.grum.fr ]

Offline

 

#27 2010-08-31 07:55:10

yuragal
Translation Team
2010-08-30
5

Re: [plugin] Advanced Metadata

grum wrote:

Here you can find a script to import xmp.dc:subject tags from the AMD database into the piwigo's tags system.

1/ first, install the plugin [extension by Piwigo Team] LocalFiles Editor
2/ copy the code given below, and put it between the <?php     ?> in the personnal plugin tabs of the LocalFileEditor plugin
3/ save the personnal plugin
4/ check if everything is OK : just go to the http://your-adress-here/admin?importAmdTags=y url ; this url will not modify the database, it just display some information about the import
5/ if everything is OK, you go to the http://your-adress-here/admin?importAmdTags=y&checkOnly=n url ; this url will update the database

When everything is done, delete the personnal plugin (not a good idea to keep this one).

Hi!

I'm stuck on the point 4. When I go to http://your-adress-here/admin?importAmdTags=y, server redirects me to http://your-adress-here. Have to note that Piwigo root directory aliased to http://my_IP/piwigo, not just http://my_IP. I'm a newbee in web-server administration/PHP programming. Could you give me a tip what's wrong?

Offline

 

#28 2010-08-31 08:53:33

grum
Former Piwigo Team
Pantin
2007-09-10
1371

Re: [plugin] Advanced Metadata

yuragal wrote:

I'm stuck on the point 4. When I go to http://your-adress-here/admin?importAmdTags=y, server redirects me to http://your-adress-here. Have to note that Piwigo root directory aliased to http://my_IP/piwigo, not just http://my_IP. I'm a newbee in web-server administration/PHP programming. Could you give me a tip what's wrong?

if your Piwigo root directory is http://my_IP/piwigo, just go to  http://my_IP/piwigo/admin?importAmdTags=y ;-)
and before doinf it, you must login as an admin.


My pictures with Piwigo, of course !
[ www.grum.fr ]

Offline

 

#29 2010-08-31 09:08:35

yuragal
Translation Team
2010-08-30
5

Re: [plugin] Advanced Metadata

grum wrote:

if your Piwigo root directory is http://my_IP/piwigo, just go to  http://my_IP/piwigo/admin?importAmdTags=y ;-)
and before doinf it, you must login as an admin.

Yes, you're right. That's literally what I'm doing:)

Being logged-in as admin, I input http://my_IP/piwigo/admin?importAmdTags=y. However, the result is redirecting to http://my_IP/piwigo

Piwigo v.2.1.2
LocalFiles Editor v2.1.0
The code for plugin saved to Piwigo_root/plugins/PersonalPlugin/main.inc.php

Offline

 

#30 2010-08-31 09:11:27

grum
Former Piwigo Team
Pantin
2007-09-10
1371

Re: [plugin] Advanced Metadata

Sorry, I have made a mistake in the URL.

http://my_IP/piwigo/admin.php?importAmdTags=y
with the .php extension, it will probably works better ^_^;


My pictures with Piwigo, of course !
[ www.grum.fr ]

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact