PhoenixKit 2.37.0: Capture dates for photos and videos, viewer opens on annotations
PhoenixKit 2.37.0 records when each photo and video was taken, opens the media viewer on the picture with its annotations drawn in, and fixes several permission and trash problems in the admin.
When a photo was taken
Storage now records a capture date for every image and video. It comes from the photo’s EXIF data or the video’s container, else from a date in the file name such as IMG_20180701_120000.jpg, else from the upload time. The date is kept in local time, so a photo taken late on 31 July in California counts as July. A date is only replaced by one from an equally strong or stronger source, and an edited image keeps the date of its unedited original.
The viewer opens on the annotated picture
The media viewer now shows the picture with its markup drawn in first, the version people look at and copy. The pencil switches to the editable layer, and turning it off saves what was drawn. A new copy is made once per change of the drawing, not on every visit. Rotated pictures now save their annotations too, which before silently failed.
Trash and settings fixes
- Trashing, restoring or deleting a file now removes it from open media browsers at once. Restoring a folder brings back only what trashing it removed.
- A trashed file’s sizes and tiles are refused to anyone without the
mediapermission, and those responses are never cached. - Two admin tabs on the same page no longer share one permission, which caused redirect loops. Detail and edit pages behind a list follow the list’s permission.
- The Settings menu entry and settings links now open the first settings page the visitor may use, instead of General.
- The admin header and a custom user settings page keep the visitor’s language.
For developers
The media browser has a readonly mode that hides and refuses every change. Live sessions now track every signed-in LiveView, one row per login. Etcher 0.17.0 is the new minimum.
Upgrading
Run mix phoenix_kit.update for migration V200, which adds four capture date columns and an index to the files table. Then date the existing files once with mix phoenix_kit.storage.backfill_capture_dates, or CaptureDateBackfillJob.enqueue() from a running node. Video dates need ffprobe; without it a video is dated by its name or upload time.
Full release notes: PhoenixKit 2.37.0
2.37.0 · 22 September 2026
Added
-
Storage records when a photo or video was taken (V200). Four columns on
phoenix_kit_files:taken_at(the UTC instant),taken_on(the LOCAL date — what a library groups by, so a photo taken late on 31 July in California is a July photo although it is August in UTC),taken_at_offsetandtaken_at_source. The date comes from EXIF (DateTimeOriginal, elseDateTimeDigitized, with their offset tags) or a video’s container (QuickTime’s creation date, elsecreation_time), else a date in the file name (IMG_20180701_120000.jpg,PXL_…,2018-07-01 12.34.56.jpg), else the upload time — so every image and video resolves to one.PhoenixKit.Modules.Storage.CaptureDatereads it;ProcessFileJobrecords it for new uploads from the bytes it already downloads, in the same guarded transaction as the dimensions. Addsphoenix_kit_files_capture_date_indexon(user_uuid, taken_on DESC, taken_at DESC), partial over a user’s visible, processed images and videos, so an edited image’s hidden backup and tile pyramids cost it nothing. -
Dating files stored before V200.
Storage.Workers.CaptureDateBackfillJobwalks the images and videos with no date in batches (enqueue/0for a background pass on thefile_processingqueue,pending_count/0), andmix phoenix_kit.storage.backfill_capture_datesruns a pass in the foreground with progress. A file whose bytes cannot be read is still dated, from its name or upload time; a pass visits each file once and cannot loop on one. -
MediaBrowserhas a view-only mode (#848).readonlyhides every write affordance (upload, new folder, rename, move, trash, select, rotate, the image editor, drag and drop) and refuses every mutating event server-side; a broadcast upload is refused where it lands. The nested viewer is read-only too — no annotating, rotating or editing details, and (post-merge review fix) no burn when the viewer closes. Navigation, search, sorting, the viewer and downloads keep working.
Changed
-
A capture date is never downgraded. An image edit keeps only the ICC profile, so an edited original carries no EXIF; re-processing one used to be harmless and now must not replace its EXIF date with a file name. Every automatic writer goes through
CaptureDate.replace?/2— a date is replaced only by one from an equally strong or stronger source, and amanualdate never — and an edited image is dated from its unedited backup (original_file_uuid), not its own bytes. -
The media viewer opens on the burned copy (#853). The picture with its markup rendered in — the thing people look at and right-click → Copy Image — is what the viewer shows first; the pencil switches to the live, editable layer, and turning it off burns what was drawn. The viewer opens on a new
burned_largeslot (fit inside 1920px);burnedstays card-sized (800px) because a grid paints many of them. A burn happens once per change of the drawing, not once per visit: the client fingerprints a canonical form of the shapes, the burn endpoint keeps it inmetadata["burn"]— merged into the row as it is now, so a rotation or title changed while a burn ran is not reverted — and it is handed back only while a burn is stored, so an image edit (which deletes the burns) does not stop the next one. The editor’s zoom ladder starts atsmalland tops out atlarge, and the viewer stays light whatever daisyUI theme the admin uses, since the burn is composed on white. -
Etcher 0.17.0 is the floor (#854).
Etcher.Rasternow bakes a dimension’s heads, every kind’s label (sized against the picture) andstyle.fill; on 0.16 a baked annotated thumbnail was hollow, unlabelled shapes. -
Every connected, authenticated LiveView mounted through a scope hook is tracked in Live sessions (#845). That covers admin pages, feature modules, a host page using the scope mount, and the public auth session. The row is one per login (
session_idis a SHA-256 of the session token, not the token itself), shared by every tab of that login, and removed when the last of them closes. It is node-local. A navigation that destroys the LiveView before the next one mounts looks like a disconnect and resetsconnected_atwhile only one tab is open. Anonymous visitors are not recorded on this path.
Fixed
-
A trashed file no longer stays on screen (#847). Trashing, restoring or permanently deleting a file — directly, or by trashing/restoring its folder — now broadcasts
{:phoenix_kit_file_trashed | _restored | _deleted, uuid}onStorage.subscribe_to_file_events/0‘s topic.MediaBrowserdrops the card and closes a viewer open on it;FeaturedImagere-resolves onsend_update(FeaturedImage, id: id, refresh: true). A trashed file’s variants are refused (404) by/file/...except to a holder of the"media"permission, whose Trash tab renders its thumbnails through that route — and that response isprivate, no-store, neverpublic: the URL is the same for every caller, so a CDN or caching proxy would otherwise have kept the holder’s copy and served it to anyone (post-merge review fix). -
Admin tab permissions are kept per action (#850). Two tabs naming the same LiveView on different
live_actions no longer collide on one cached entry, where a tab’sprioritysilently decided which key guarded both routes (a redirect loop for users holding the page’s own key). An action with no tab of its own —:show/:editof a LiveView whose tab is:index— is guarded by the module’s tab permission when its tabs all agree on one; before the post-merge review fix it resolved to nothing and locked partial roles out of every record behind the list. -
The Settings sidebar entry opens a page its viewer can use (#851). It was shown to holders of any settings-related permission but always linked to General, gated on
"settings"alone; it now links to the first settings subtab the viewer can open, and still to General for a"settings"holder whatever priority a module gives its own subtab. -
A folder operation is announced once, not once per file. Trashing, restoring or permanently deleting a folder sends one
{:phoenix_kit_files_trashed | _restored | _deleted, [uuid]}for every file it swept up (single-file operations keep{:phoenix_kit_file_*, uuid}); a folder of thousands of files was thousands of messages and re-renders for every open browser. A host reacting to one file must match both shapes — seeFeaturedImage’s moduledoc. A file a permanent folder delete re-homes into a trashed folder, and the files a media reorganize restores, are now announced too. -
Restoring a folder restores only what trashing it trashed. A file trashed on its own before or after the folder stays in the trash (it was restored along with the folder, and so were files never trashed at all).
-
Opening a trashed file’s thumbnails costs one permission lookup per burst, not two queries per image: the answer is cached for five seconds per user and active role.
-
The admin header and a
user_settings_pathoverride keep the visitor’s language (#852). The project title links to the host’s own/<locale>home when its router serves one (else/), never to core’s mount point; an override page gets the locale segment the default settings page would, and neverurl_prefix. -
Every way into Settings lands on a page its viewer can open. A visitor refused Settings → General who can open another settings subtab is taken there — from a settings page’s section header, a bookmark or a typed URL, not only from the sidebar. Both sidebars and this redirect follow one rule (
TabHelpers.redirect_target/2), and the user dashboard’s sidebar now also keeps a parent’s own landing page when it is reachable. -
A rotated picture burns. The burn recovered its scale from the screen X of two image points, which is 0 at a quarter turn and negative at a half turn, so a saved rotation made every burn a silent no-op and the viewer kept opening on the old copy. The mapping is now the full image→screen affine, and the burned pixels stay unrotated (the viewer reapplies the rotation). Stepping to the next or previous file burns on the way out, and the stand-in paints the variant the viewer opens on (
burned_large, elseburned, elsesmall) instead of flashing the cleansmall. -
A readonly viewer does not create annotation comments. Reply stays on the tooltip of a locked shape;
annotation_replyis refused when the viewer cannot annotate. -
An untabbed action stays unmapped when a LiveView’s tabs disagree. Namespace inference (
PhoenixKit.Modules.Reports.Web→"reports") no longer authorizes a:show/:editthat neither tab named. Tabs that agree still guard those actions, and a tab registered for the whole module (no action) still guards every action no other tab names. -
A trashed file’s refusal is not cacheable, and neither are its tiles. The 404 from
/file/..., the file info endpoint and the unedited-original endpoint isprivate, no-store. Deep-zoom manifests and tiles use the same media-holder gate as/file/...and, when served, areprivate, no-storerather than a year-long public response. -
A capture-date backfill does not lock in the wrong date. An image edit that lands while a file is being dated leaves
taken_atempty so the next pass reads the unedited backup, instead of storing the file name. A video whose streamcreation_timeis an unset epoch no longer hides the container’s real instant. A cross-user copy keeps the donor’s date, andStorage.store_file/2(comment attachments) records one from the bytes it stores.
Upgrading: run mix phoenix_kit.update for V200, then date the existing
library once with mix phoenix_kit.storage.backfill_capture_dates (or
CaptureDateBackfillJob.enqueue() from a running node). Video dates need
ffprobe; without it a video is dated from its file name or upload time,
the same way its dimensions and duration already degrade.
PhoenixKit 2.37.0. Install or update: {:phoenix_kit, "~> 2.37"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.