Replacing an existing image via pwg.images.add and tag removal #470

Open
opened 2026-10-05 00:00:08 +02:00 by adam · 0 comments
Owner

This is probably an extremely rare scenario, yet is causes some issues with the Lightroom plugin...
Step 1 - upload a photo with keyword tags. Works OK
Step 2 - replace the photo AND remove all tags - the photo is replaced, however all previously assigned tags remain.

This is caused by the following code in ws_images_add:

  if (isset($params['tag_ids']) and !empty($params['tag_ids']))
  {
    set_tags(
      explode(',', $params['tag_ids']),
      $image_id
      );
  }

Note, tags will set only when the tag_ids parameter is not empty. But when I want to clear all tags, the value is an empty string!

When pwg.images.add is invoked with the image_id parameter, it must respect single_value_mode and multiple_value_mode (just the way it works in ws_images_setInfo), otherwise replacing the photo and updating its properties works incorrectly.

This is probably an extremely rare scenario, yet is causes some issues with the Lightroom plugin... Step 1 - upload a photo with keyword tags. Works OK Step 2 - replace the photo AND remove all tags - the photo is replaced, however all previously assigned tags remain. This is caused by the following code in **ws_images_add**: ``` if (isset($params['tag_ids']) and !empty($params['tag_ids'])) { set_tags( explode(',', $params['tag_ids']), $image_id ); } ``` Note, tags will set only when the tag_ids parameter is not empty. But when I want to clear all tags, the value is an empty string! When pwg.images.add is invoked with the **image_id** parameter, it must respect **single_value_mode** and **multiple_value_mode** (just the way it works in **ws_images_setInfo**), otherwise replacing the photo and updating its properties works incorrectly. <!-- github-sync-id:159854836 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#470