feat(ImageView): use Photos metadata for pre-sized, blurhashed image placeholders #7275
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Summary
This introduces a cross-app "dependency" on metadata currently provided by image uploads when Photos is enabled (although it fails gracefully without it). When present in oc_files_metadata, this uses photos-size.value.width and height (and blurhash.value) to show a placeholder of correct size before the image itself loads.
Notes:
While it's slick on Firefox, Chrome (or Chromium anyway) has a noticeable gap between removing the placeholder and adding the loaded image. Any ideas? (I'd like to fix this before merge ideally.)Fixed, the preload wasn't working because of some cache invalidation, so it had to download the image twice. Thanks Julius :)The blurhash logic could be abstracted out since it's similar to what's in photos, but I feel one repetition does not justify it yet. As always, happy to accommodate if anyone feels differently.Now uses NcBlurHash.General pointers about Vue best practices or local conventions also appreciated.
🖼️ Videos
🏚️ Before
resize before.webm
🏡 After (firefox)
resize after.webm
🏡 After (chromium)
resize after chrome.webmresize after chrome.webm
🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)