27 Thumbnails
3 operations.
27.0.1 generateThumbnail
POST /api/thumbnails/generate
Creates the preview thumbnail for one photo.
Why it exists. ‡ Generate and store a thumbnail for one image, so the gallery has something small to show for an image that has not been processed yet.
Called by — lib/services/thumbnail-service.ts
Reached from — /w/data-explorer/assets · /w/data-explorer/categories · /w/data-explorer/new-dataset · /w/data-explorer/storage · /w/integrity/actions · /w/integrity/assets …and 7 more
Generates a 300x300 JPEG thumbnail for a single image and stores it in Supabase Storage. The thumbnail URL is automatically saved to the database.
Authentication: SupabaseAuth, CookieAuth
Uses a service-role client (row-level security bypassed).
Returns — success · thumbnailUrl · imageId
Field names as the handler returns them; the source states no types for them.
Effect — writes (update) datasets · images · thumbnails
Request body
| Field | Type | Required |
|---|---|---|
imageId |
string | yes |
Responses
| Status | Meaning | Body |
|---|---|---|
200 |
Thumbnail generated successfully. | |
400 |
Missing imageId. | Error |
401 |
Not authenticated. | Error |
404 |
Image or dataset not found or access denied. | Error |
500 |
Thumbnail generation failed. | Error |
27.0.2 generateThumbnailsBulk
POST /api/thumbnails/generate-bulk
Creates thumbnails for every photo in a dataset that lacks one, in controlled batches.
Why it exists. ‡ Generate thumbnails for a dataset’s images that lack them, in batches, so a newly indexed dataset becomes browsable without a request per image.
Called by — components/admin/thumbnail-generator.tsx
Processes multiple images from a dataset to generate thumbnails. Only processes images that don’t already have thumbnails. Processes images in batches with concurrency control to avoid overwhelming the system.
Authentication: SupabaseAuth, CookieAuth
Uses a service-role client (row-level security bypassed).
Returns — success · message · processed · errors · total · results
Field names as the handler returns them; the source states no types for them.
Effect — writes (update) datasets · images · thumbnails
Request body
| Field | Type | Required |
|---|---|---|
datasetSlug |
string | yes |
limit |
integer | no |
Responses
| Status | Meaning | Body |
|---|---|---|
200 |
Bulk thumbnail generation completed. | |
400 |
Missing datasetSlug. | Error |
401 |
Not authenticated. | Error |
404 |
Dataset not found. | Error |
500 |
Server error. | Error |
27.0.3 generateVideoThumbnail
POST /api/thumbnails/generate-video
Creates a preview image from a video by capturing a frame.
Why it exists. † Extract a still from a video at a given moment and store it as the video’s thumbnail, so video entries are not blank in the gallery.
Generates a thumbnail from an MP4 video file by extracting a frame at a specified timestamp using FFmpeg.
Authentication: SupabaseAuth, CookieAuth
Uses a service-role client (row-level security bypassed).
Returns — success · thumbnailUrl · message
Field names as the handler returns them; the source states no types for them.
Effect — writes (update) datasets · images · organization_members · thumbnails
Request body
| Field | Type | Required |
|---|---|---|
videoId |
string | yes |
datasetSlug |
string | yes |
timestamp |
number | no |
maxWidth |
integer | no |
maxHeight |
integer | no |
quality |
integer | no |
Responses
| Status | Meaning | Body |
|---|---|---|
200 |
Thumbnail generated successfully. | |
400 |
Missing required fields, an invalid video file, or a malformed numeric field. | Error |
401 |
Not authenticated. | Error |
403 |
Forbidden — user doesn’t have access to the dataset. | Error |
404 |
Dataset or video not found. | Error |
500 |
Server error — FFmpeg processing failed or storage error. | Error |