Tag interface with external AI tools #1591

Open
opened 2026-10-05 00:49:23 +02:00 by adam · 3 comments
Owner

Hi I am willing to write a simple MySQL script that can connect to the piwigo db to create and add tags to photos. This would allow integration with photoprism and other tools (any, potentially, and also implement tagging rules).
Today we have mugshot which does not work in the background and is constrained to whatever is explicitly coded in there. What I want to write is a function that allows to assign tags to files directly on db (that should be done by editing image_tags) and create or check tags. This part I am missing, I need to alter the list of tags adding entries, for example I identify “John Smith” on photo 1 , photo 7 and photo 346 using another tool. I need to check whether a tag called “John Smith” exists or not, create it if not, and assign it to photos. However I do not find the tag names linked to their tag ids. Help?

Hi I am willing to write a simple MySQL script that can connect to the piwigo db to create and add tags to photos. This would allow integration with photoprism and other tools (any, potentially, and also implement tagging rules). Today we have mugshot which does not work in the background and is constrained to whatever is explicitly coded in there. What I want to write is a function that allows to assign tags to files directly on db (that should be done by editing image_tags) and create or check tags. This part I am missing, I need to alter the list of tags adding entries, for example I identify “John Smith” on photo 1 , photo 7 and photo 346 using another tool. I need to check whether a tag called “John Smith” exists or not, create it if not, and assign it to photos. However I do not find the tag names linked to their tag ids. Help? <!-- github-sync-id:1485355327 -->
Author
Owner

Nevermind I found the tables. So I’m going to write a “mass files-tags” sql interface. Any advice, will it work or I am missing something?

Nevermind I found the tables. So I’m going to write a “mass files-tags” sql interface. Any advice, will it work or I am missing something? <!-- github-comment-id:1343342711 -->
Author
Owner

I just stumbled upon this and while I'm not an active developer on this project, I have an interest in also having AI tagging done. While there are a few existing AI plugins available, I'm looking for a plugin that can learn from existing tags and only apply defined tags. The tags should also be in a pending state until approved by a moderator. Is that the type of thing you may be doing?

Nevermind I found the tables. So I’m going to write a “mass files-tags” sql interface. Any advice, will it work or I am missing something?

Couldn't you use the built-in Mass Insert function? Just to keep new code usage to a minimum.

https://github.com/Piwigo/Piwigo/blob/1ec5a2933cbd221a32556fdca6ea54e076f60383/include/dblayer/functions_mysql.inc.php#L399

mass_inserts($table_name, $dbfields, $datas, $options=array())

The constants for the tags table and image tags table are:

TAGS_TABLE
IMAGE_TAG_TABLE

I just stumbled upon this and while I'm not an active developer on this project, I have an interest in also having AI tagging done. While there are a few existing AI plugins available, I'm looking for a plugin that can learn from existing tags and only apply defined tags. The tags should also be in a pending state until approved by a moderator. Is that the type of thing you may be doing? > Nevermind I found the tables. So I’m going to write a “mass files-tags” sql interface. Any advice, will it work or I am missing something? Couldn't you use the built-in Mass Insert function? Just to keep new code usage to a minimum. https://github.com/Piwigo/Piwigo/blob/1ec5a2933cbd221a32556fdca6ea54e076f60383/include/dblayer/functions_mysql.inc.php#L399 ```mass_inserts($table_name, $dbfields, $datas, $options=array())``` The constants for the tags table and image tags table are: ```TAGS_TABLE``` ```IMAGE_TAG_TABLE``` <!-- github-comment-id:1356379020 -->
Author
Owner

Following!

Following! <!-- github-comment-id:1475279609 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1591