PhoenixKit.Modules.Storage.AnnotationThumbnail (phoenix_kit v1.7.167)

Copy Markdown View Source

Bakes Etcher annotation shapes into a single PNG thumbnail variant.

A file with annotations gets one extra variant — "thumbnail_annotated" — a small square PNG with the shapes drawn on top (via ImageMagick convert -draw). The media browser grid uses it instead of the plain thumbnail, so the markup is visible without rendering shapes live for every viewer.

It's a single deterministic variant slot: each regeneration overwrites it (no history piles up). When the last annotation is removed, the variant is dropped and the grid falls back to the plain thumbnail.

Shapes are stored in image-pixel coordinates, so they're drawn at original scale on the original image (the geometry → draw mapping lives in Etcher.Raster, which owns the shape format), then the whole thing is resized

  • center-cropped to the thumbnail square — the crop clips edge shapes exactly like the grid.

Regeneration is meant to run in the background (see AnnotationThumbnailJob), debounced so a flurry of edits collapses into one render.

Summary

Functions

Whether baked annotated thumbnails are enabled (media setting; default false).

Regenerate (or remove) the baked annotated thumbnail for file_uuid.

The variant name this module produces.

Functions

enabled?()

Whether baked annotated thumbnails are enabled (media setting; default false).

Gates generation and display — see the media settings page, "Media Configuration" section.

refresh(file_uuid)

Regenerate (or remove) the baked annotated thumbnail for file_uuid.

Returns {:ok, instance} when (re)generated, {:ok, :removed} when there's nothing to draw, or {:error, reason}.

variant_name()

The variant name this module produces.