Skip to content

fix(web): use original image if web compatible #17347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 3, 2025
Merged

Conversation

mertalev
Copy link
Contributor

@mertalev mertalev commented Apr 2, 2025

Description

#14446 has a regression in that original images are never displayed. This PR changes the logic to prefer the original over the fullsize image if it's web-compatible. Also reverts back to using the thumbhash as cache key, as it was changed back to checksum in that PR.

Fixes #17334

How Has This Been Tested?

Tested that an HEIC image is displayed in Safari when zooming in and continues to be displayed after zooming out. Enabling "Display original images" makes it display the HEIC image immediately.

@mertalev mertalev requested a review from danieldietzler as a code owner April 2, 2025 21:19
@alextran1502 alextran1502 merged commit e8b4ac0 into main Apr 3, 2025
45 checks passed
@alextran1502 alextran1502 deleted the fix/web-display-heic branch April 3, 2025 14:01
);
const targetImageSize = $derived.by(() => {
if ($alwaysLoadOriginalFile || forceUseOriginal || originalImageLoaded) {
return isWebCompatibleImage(asset) ? 'original' : AssetMediaSize.Fullsize;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, was just taking a quick look here, but what happens if a User has $alwaysLoadOriginalFile = true, but they have not enabled the Fullsize preview generation? This function would return the targetImageSize as Fullsize, but the user won't have that generated.

Would this then internally fallback to the Preview image somewhere (I tried to follow the logic till the utils folder but could not find the fallback, maybe I missed something?) or can the image fetch fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The client will be redirected to request the preview instead in this case, which also means the cached preview can be used instead of fetching the preview again from a different link.

kirill-dev-pro pushed a commit to kirill-dev-pro/immich-but-with-public-albums-within-instance that referenced this pull request Apr 6, 2025
* use original image if web compatible

* add e2e

* fix shared link handling

* handle redirect in e2e

* fix size not being passed to thumbnail url

* test fullsize in e2e
midzelis pushed a commit that referenced this pull request Apr 10, 2025
* use original image if web compatible

* add e2e

* fix shared link handling

* handle redirect in e2e

* fix size not being passed to thumbnail url

* test fullsize in e2e
savely-krasovsky pushed a commit to savely-krasovsky/immich that referenced this pull request Jun 8, 2025
* use original image if web compatible

* add e2e

* fix shared link handling

* handle redirect in e2e

* fix size not being passed to thumbnail url

* test fullsize in e2e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HEIC/HEIF original images not loading in Safari 18.3.1
5 participants