#1 2025-12-23 01:40:33

SchuminWeb
Member
Maryland, USA
2024-02-20
48

Need to output a list of keywords on a photo in plain text

Hello/Hi/Greetings,

I am trying to output the list of tags/keywords from a photo on my Piwigo installation as plain text in order to use downstream from Piwigo.  The way that my workflow goes is that I upload my photos to Piwigo, and then I do a second, separate upload to Fine Art America afterward for print sales and the like.  Fine Art America takes all of the same metadata that Piwigo does, i.e. title, description, and keywords.  Title and description copy and paste over just fine.  However, I have found no way to copy and paste my keywords in plain text from Piwigo to Fine Art America.  When I try to drag and copy, either from the front end or the back end, they simply will not select in the browser in order to copy to the clipboard in order to paste into Fine Art America.  The only thing that I know to do at this point is to manually retype it all into Fine Art America, but that is too time-consuming and labor-intensive to be feasible, especially when I've already entered it in once before.

Is there something special that I should be doing in order to output this list as plain text?

Environment details:
Piwigo 16.1.0 Check for upgrade
Installed on 12 July 2024, 1 year 5 months 1 week 2 days ago
Operating system: Linux (container)
PHP: 8.2.29 (Show info) [2025-12-22 16:38:19]
MySQL: 8.0.41-0ubuntu0.22.04.1 [2025-12-22 16:38:19]
Graphics Library: External ImageMagick 6.9.11-60
Cache size 29631.78 Mo   calculated 1 month ago

Piwigo URL: https://www.benschumin.com/

Offline

 

#2 2025-12-24 03:42:26

moberley
Member
2025-11-10
90

Re: Need to output a list of keywords on a photo in plain text

I am unsure if there is a better way to get the keywords together in plain text if your gallery theme template doesn't allow you to copy them directly but it should be possible with a template prefilter.

I tried the following code on my server to expose the list of tags as plain text at the bottom when viewing the "Edit Photo" page (e.g. /admin.php?page=photo-1) and it seemed to work. This delimits the keywords with a comma and a space but you could set it up however you need.

Code:

add_event_handler('loc_end_picture_modify', 'personal_picmod_display_tags');
function personal_picmod_display_tags()
{
  global $template;
  $template->set_prefilter('picture_modify', 'personal_prefilter_display_tags');
}

function personal_prefilter_display_tags($content, $smarty)
{
  $search = '#<div class="savebar-footer">#';
  $replacement = '<p><b>Tags (plain):</b> {foreach $tag_selection as $tag}{$tag.name}{if $tag@last}</p>{else}, {/if}{/foreach}';
  $replacement .= '<div class="savebar-footer">';
  return preg_replace($search, $replacement, $content);
}

Offline

 

Board footer

Powered by FluxBB