feat(ImageView): use Photos metadata for pre-sized, blurhashed image placeholders#7275
Merged
emberfiend merged 1 commit intomainfrom Jun 16, 2025
Merged
feat(ImageView): use Photos metadata for pre-sized, blurhashed image placeholders#7275emberfiend merged 1 commit intomainfrom
emberfiend merged 1 commit intomainfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7275 +/- ##
==========================================
+ Coverage 52.18% 59.00% +6.81%
==========================================
Files 483 482 -1
Lines 41918 37081 -4837
Branches 1047 1046 -1
==========================================
+ Hits 21875 21878 +3
+ Misses 19940 15101 -4839
+ Partials 103 102 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9a3f26e to
73743d6
Compare
juliusknorr
approved these changes
Jun 12, 2025
Member
juliusknorr
left a comment
There was a problem hiding this comment.
Approving already so it can get in after the @nextcloud/vue bump is in
| if (this.imageWidth > 0 && this.imageHeight > 0) { | ||
| const ratio = this.imageWidth / this.imageHeight | ||
| const newWidth = | ||
| this.wrapperWidth - 12 > this.imageWidth |
Member
There was a problem hiding this comment.
As discussed not a blocker but would be nice to base this and the paddings on the image view on the css variables so they adjust if designers change their minds about spacing.
62c8c11 to
a0a3e46
Compare
Signed-off-by: Andrew Backhouse <andrew.backhouse@nextcloud.com>
a0a3e46 to
c1de72b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)