feat(lightbox): surface original camera filenames (#508)

Photographers running the gallery as a client-selection tool want to
map a guest's picks back to source files for retouching. The
`general_use_original_filenames_for_downloads` toggle (#493) already
does this on the download side; this extends the same toggle to the
in-lightbox view so the camera filename is visible alongside the
photo while it's being looked at.

Tied to the same toggle on purpose — one switch controls both
surfaces. Off by default; existing galleries keep showing only the
position counter.

Wiring:
- gallery.js serializes `photos[].original_filename` and surfaces the
  resolved toggle as `event.use_original_filenames` so the client can
  decide whether to render it.
- The bespoke `PhotoLightbox` renders the original filename (falling
  back to the storage filename only for pre-migration-062 uploads) in
  a muted line under the position counter, truncated to keep the
  toolbar tidy.
- `GalleryStoryLayout` mounts the same `PhotoLightbox`, so its
  rendering follows along.
- `GalleryPremiumLayout` uses `yet-another-react-lightbox` instead;
  added the Captions plugin and a `title` field on the slides so the
  same name appears as a caption when the toggle is on.

The remaining layouts feed back into the main `PhotoLightbox` via
`PhotoGridWithLayouts`, so the prop reaches them through the layout
props bag.
This commit is contained in:
Paul Nothaft
2026-05-17 00:35:16 +02:00
parent 38343e62de
commit 33de294d57
8 changed files with 77 additions and 8 deletions
+8
View File
@@ -88,6 +88,10 @@ export interface GalleryInfo {
export interface Photo {
id: number;
filename: string;
// Original camera filename (e.g. DSC_1234.jpg) — populated for uploads
// post migration 062. Null for legacy rows. Surfaced in the lightbox
// when the admin toggles `use_original_filenames` on (#508).
original_filename?: string | null;
url: string;
thumbnail_url?: string;
hero_url?: string; // Hero-optimized image URL (1920x1080) for full-width hero sections
@@ -168,6 +172,10 @@ export interface GalleryData {
hero_image_anchor?: string;
// Default photo sort order
default_photo_sort?: string;
// Mirror of admin's `general_use_original_filenames_for_downloads`.
// When true, the lightbox surfaces each photo's `original_filename`
// alongside the position counter (#508).
use_original_filenames?: boolean;
};
categories?: PhotoCategory[];
photos: Photo[];