Skip to content
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

feat(web): Show lens model in the asset viewer detail panel #15460

Merged
merged 3 commits into from
Jan 23, 2025

Conversation

bxtdvd
Copy link
Contributor

@bxtdvd bxtdvd commented Jan 20, 2025

This adds the lens model information to the EXIF area of the asset view info detail panel. This is useful because the display of the focal length alone doesn't necessarily tell you what lens you used for a particular shot.

Additionally, I've made both the camera make/model and the lens model clickable links. These go to the search page with a query of either that camera make + camera model (if you click on the camera make/model), or the lens model (if you click on the lens model).

This is based on and inspired by the link part of #15049, which has been super useful to me.

This is my first PR and I'm a Svelte newbie, so please let me know if there's anything I did wrong. I ran the code through all the npm checks.

Screenshot 2025-01-19 at 8 59 41 PM

@alextran1502
Copy link
Contributor

alextran1502 commented Jan 20, 2025

Thank you for the PR. I have two concerns about the changes that I don't know how to resolve.

  1. There is no UI indicator that these two items are clickable.
  2. the lens info will be long for many iPhone users. It will be displayed as two lines of text. It looks a bit cluster

I came up with an attempt for solutions, but I am still not very happy with it wrt the density of information.

image image

@chrneu
Copy link

chrneu commented Jan 20, 2025

Would it be possible to crop the second line out and display the full length as ALT attribute? In the end the content of the second line from the iPhone is duplicated information anyway. Normally, the important lens information should usually be stated first by the manufacturer.

@bxtdvd
Copy link
Contributor Author

bxtdvd commented Jan 20, 2025

I like the idea of clamping the line and providing the remaining text in the hover. The most important info does usually come first.
Screenshot 2025-01-20 at 8 21 05 AM

I did initially think about doing this with a search icon, but was concerned that might be too visually noisy for a somewhat niche feature. I'm not a UI/UX designer, so I'm certainly open to any other ideas here, too.

Showing the lens model is the most important part of this feature. If linking to the search makes things too clunky for the UI, then I can remove that.

title={$t('search_for_lens')}
class="hover:dark:text-immich-dark-primary hover:text-immich-primary"
>
{asset.exifInfo.lensModel || ''}
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think this logical OR is needed because of the if on 439.

Comment on lines 429 to 436
<a
href={getCameraSearchHref(asset)}
title={$t('search_for_camera')}
class="hover:dark:text-immich-dark-primary hover:text-immich-primary"
>
{asset.exifInfo.make || ''}
{asset.exifInfo.model || ''}
</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

If neither the make nor model are set, will this still render the a? Seems like you'd want to do the check higher up, similar to line 439.

const cameraSearchUrl = new URL(AppRoute.SEARCH, globalThis.location.href);
cameraSearchUrl.searchParams.set(
QueryParameter.QUERY,
`{"make":"${asset.exifInfo?.make}","model":"${asset.exifInfo?.model}"}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

This'll not work if the make or model have double quotes in them. It's probably best to use JSON.stringify for the entire value. Same concerns with getLensModelSearchHref.

I also think this'll give you unexpected results if the make is unset or if the model is unset, since converting undefined to a string gives you the string literal "undefined".

Additionally, you could probably deduplicate the two get*Href functions further since everything but the value parameter of the set call is the same.

Does a helper function already exist to be able to specify the search URL? Quick digging reveals getMetadataSearchQuery, so I imagine you'd want to use that and/or whatever code currently calls this function.

@dclobato
Copy link

This adds the lens model information to the EXIF area of the asset view info detail panel

Nice! Looking forward to have this PR merged! 🤞

@alextran1502
Copy link
Contributor

I like the idea of clamping the line and providing the remaining text in the hover. The most important info does usually come first. Screenshot 2025-01-20 at 8 21 05 AM

I did initially think about doing this with a search icon, but was concerned that might be too visually noisy for a somewhat niche feature. I'm not a UI/UX designer, so I'm certainly open to any other ideas here, too.

Showing the lens model is the most important part of this feature. If linking to the search makes things too clunky for the UI, then I can remove that.

Let's implement the elapsed text here and not add the search icon but keep the search feature. We can find a way to make an indicator nicer later

@bxtdvd
Copy link
Contributor Author

bxtdvd commented Jan 22, 2025

Thanks Alex. I was away on travel yesterday, but I'll update the code with this — as well as with the changes that Snowknight26 suggested — this evening.

@bxtdvd
Copy link
Contributor Author

bxtdvd commented Jan 23, 2025

I've updated the code with the lens model clamped to 1 line.

I've also simplified the implementation a bit by using the existing getMetadataSearchQuery helper function. I also added additional error checking for situations where either camera make or model is blank. I tested this with some photos where I removed make or model with exiftool.

Thanks @Snowknight26 for the review and your suggestions on how I could improve the code!

Copy link
Contributor

@alextran1502 alextran1502 left a comment

Choose a reason for hiding this comment

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

Thanks much! looks very good

@alextran1502 alextran1502 merged commit f32c5d9 into immich-app:main Jan 23, 2025
33 checks passed
vladd11 pushed a commit to vladd11/immich that referenced this pull request Jan 25, 2025
…pp#15460)

* Adds lens details to the asset viewer

* Update lens detail search links

---------

Co-authored-by: Alex Tran <[email protected]>
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.

5 participants