Refactor dish image pipeline around PocketBase originals #15
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ben/LovePlate#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Refactor dish images so PocketBase owns the original image, while the device persistently stores only UI-sized derivatives plus optional on-demand cached originals. Grid/list/detail UI should use a 640px local display image; glass blur should use a smaller blurred local image; full-screen viewing should download/cache the PocketBase original only when requested.
Chosen defaults:
remoteImageFilename; local-only unsynced originals are kept until upload.Key Changes
Dishwith explicit image paths:displayImagePath: local 640px image used by grid/list/detail/Tinder/shopping avatars.blurredImagePath: local ~320px blurred image used for glass effects.cachedOriginalImagePath: optional full original downloaded from PocketBase on demand.pendingUploadImagePath: temporary local original for newly picked/edited images until sync upload succeeds.imagePathas legacy migration input only; stop writing new UI logic against it.dish.g.dartwithflutter pub run build_runner build.ImageServicehelpers with explicit APIs:createLocalImageSet(sourcePath)creates/copiespendingUploadImagePath,displayImagePath, andblurredImagePathin app documents.createDerivativesFromOriginal(sourcePath)creates display + blur files.deleteDishImageFiles(dish)deletes display, blur, cached original, pending upload, and legacy derivative files.getOrDownloadOriginal(dish, pocketBase)returns cached original if present, otherwise downloads from PocketBase and storescachedOriginalImagePath.Implementation
image_pickerwithmaxWidth: 1920, maxHeight: 1920.pendingUploadImagePath, generate 640px display image and ~320px blurred image once, then store those paths on the dish.displayImagePathandblurredImagePath; it should not render from picker temp paths or original files.pendingUploadImagePathwhen present; fallback to legacyimagePathonly during migration.remoteImageFilename, clear/deletependingUploadImagePath, and delete legacy local original if safe.remoteImageFilenamechanges, regenerate derivatives and delete stale derivative/cached-original files.DishCard, detail header, Tinder card, and shopping avatar usedisplayImagePath.blurredImagePath; if missing, trigger derivative repair and fall back to display image or placeholder.displayImagePathimmediately, then downloads/caches the original from PocketBase and crossfades to it.displayImagePathandblurredImagePathfiles only.cachedOriginalImagePathandpendingUploadImagePath.imagePath, generate missing display + blur paths.remoteImageFilenameexists, delete the legacy original and old_thumb/_blurfiles after successful derivative generation.remoteImageFilenameexists or dish is dirty, keep/copy the legacy original aspendingUploadImagePathso sync can still upload it.Test Plan
remoteImageFilenamereplaces stale local derivatives.dart format.flutter pub run build_runner build.flutter analyze; existing unrelated warnings may remain.Assumptions
remoteImageFilenameexists or the original is only a cached full-screen copy.