Let editors choose the icon position per image

Problem/motivation

The icon position is set once for the site (#61 (closed)), and for burned-in labels once per image style (#62 (closed)). On some images the corner hides what the reader needs to see, such as a face, a logo or a caption in the picture. Editors have no way to move it for that one image.

The choice cannot be made per content item. A burned-in label lives in the derivative, and a derivative is shared by every entity that shows the same file with the same style. Two articles using one photo would ask for two corners on one file.

Proposed resolution

  • An optional position override per file, chosen by the editor: top right, top left, bottom right or bottom left.
  • Inheritance: the file override, then the image style setting (burned-in label only), then the site setting. Size, margin and variant always come from the style or the site.
  • The overlay (#61 (closed)) and the burned-in label (#62 (closed)) read the same value, so one image never shows the icon in two corners.
  • The field sits on the media form, next to the disclosure widget, and only when the file resolves to a disclosure that shows an icon.
  • When the file is used elsewhere, the form says so before saving: "This position also applies to N other items that show this image", with a list of them from file usage.
  • Saving the override flushes the derivatives of that file (#63 (closed)).
  • Stored in a table of the module keyed by file ID. No change to the disclosure field schema.

Remaining tasks

  • Storage and update hook for the new table
  • Resolution order in the overlay and in the image effect
  • Media form element with the shared-usage notice
  • Kernel tests for the inheritance order, functional test for the notice
  • Docs

User interface changes

A position select on the media form, with a notice when the image is used by other content.

API changes

A method that returns the effective position for a file.

Data model changes

A new table ai_disclosure_icon_position (fid, position). The disclosure field is unchanged.

Part of #56 (closed).

AI Compliance

🤖 Generated with the help of an LLM, reviewed and approved by me before posting.

Edited by Giorgio Alfredo Pagano