Announcement

  •  » Extensions
  •  » [Plugin] Write_metadata error and solution

#1 2014-08-03 14:44:53

HariS
Member
2014-08-03
14

[Plugin] Write_metadata error and solution

Hello,
I have found error in Write_metadata plugin.

First of all, there is missing one important information, that the plugin is dependent on ExifTool – I spend few hours of investigation other things (like security) to get it work. OK, I found this and now it’s working, at least it is able to write metadat into files.

When I played with it, I realized, that tags are not written correctly or are even shortened. I checked documentation of ExifTool and the code in main.inc.php and found the error:
Every keyword in the command line for calling ExifTool must by listed alone with its “private” option -IPTC:Keywords= (maybe -keywords is sufficient). So I made few changes in the main.incphp file, listed bellow:

Line 122:

Code:

GROUP_CONCAT(tags.name) AS tags,

Changed to

Code:

GROUP_CONCAT(CONCAT(\'-IPTC:Keywords="\', tags.name, \'"\') SEPARATOR \' \') AS tags,

Line 136:

Code:

 $tags = wm_prepare_string($row['tags'], 64);

Changed to:

Code:

 $tags = wm_prepare_tags($row['tags']);

Line 176

Code:

$command.= ' -IPTC:Keywords="'.$tags.'"';

Changed to:

Code:

$command.= ' '.$tags;

And last, on line 193 insert this new function:

Code:

function wm_prepare_tags($string)
{
  return wm_explode_description(
    wm_decode_html_string_to_unicode($string)
  );
}

Now tags are correctly written in the file. The only thing, which was omitted, is cutting the every single keyword to max 64 characters in length, but I think it is not necessary, it certainly is not common to have so long tags…

I think, the plugin could be even more useful, if there could be an option to save metadata automatically when saving changes to database, without explicit clicking on “write metadata” link. Or at least it could be configurable. The same may apply to batch operations.


Piwigo version: 2.6.3
PHP version: 5.5.13
MySQL version: 5.5.37 (MariaDB)

Offline

 

#2 2014-08-03 14:51:47

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13277

Re: [Plugin] Write_metadata error and solution

Thank you HariS, I will tell you when it's integrated.

Offline

 

#3 2014-10-17 13:15:12

chazzo
Member
2014-10-17
9

Re: [Plugin] Write_metadata error and solution

HariS, thanks for this. But would you (or Pierrick) mind answering an idiot question: how do I check that ExifTool is available?

I am running Piwigo 2.7 on a cheap shared host, and if ExifTool is not already available I don't think my ISP would agree to install it.

When I try to write metadata I get the green "OK" notice, but the image files are not updated. Is that because ExifTool isn't available (in which case it would be good to see an error message)? Or could it simply be a permissions problem?

Many thanks for advice

Charles

Offline

 

#4 2014-10-17 13:26:14

HariS
Member
2014-08-03
14

Re: [Plugin] Write_metadata error and solution

chazzo,
I cannot tell you, how to check ExifTool existency on your server - in may case it was on my own NAS, so I have full access to entire system. BTW, it was also big challenge to get it work on the NAS...

Offline

 

#5 2014-10-17 14:45:16

chazzo
Member
2014-10-17
9

Re: [Plugin] Write_metadata error and solution

HariS wrote:

BTW, it was also big challenge to get it work on the NAS...

Thanks for that. I might persuade the hosting company to install ExifTool, but they are not going to mess around to configure it. I would love to have shell access but this is a low-budget community project and I don't think we can justify it.

But of course I have just realised that I can download everything by FTP, then run it locally with MAMP and my own copy of ExifTool. So not as elegant, but it should work. Thank you for the suggestion!

I have just switched from Menalto Gallery 3, and was very pleased to find the plugin to make that migration quite painless. But for the future it would be great to update the embedded metadata, just in case.

So, plg, could you please make sure that the next version of the plugin shows an error if it can't find ExifTool (assuming that is my problem)?

And would it be possible to embed ExifTool in the plugin, or allow users to link to a copy uploaded somewhere in the Piwigo file structure? I guess probably not, but I don't understand these matters very well.

Offline

 
  •  » Extensions
  •  » [Plugin] Write_metadata error and solution

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2019 · Contact