immich icon indicating copy to clipboard operation
immich copied to clipboard

feat(mobile): Used cached network image to display people picture

Open JobiJoba opened this issue 6 months ago • 1 comments

Description

Previously, people image where shown using NetworkImage, I've created a common widget as it was the exact same code everywhere and use CachedNetworkImage instead

**I'm wondering if it won't be better to use the ImmichImage instead?? **

Fixes # (issue)

How Has This Been Tested?

Multiple places used a Circle Avatar People

Screenshots (if appropriate)

image

Checklist:

  • [x] I have performed a self-review of my own code
  • [x] I have made corresponding changes to the documentation if applicable
  • [x] I have no unrelated changes in the PR.
  • [x] I have confirmed that any new dependencies are strictly necessary.
  • [x] I have written tests for new code (if applicable)
  • [x] I have followed naming conventions/patterns in the surrounding code
  • [x] All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • [x] All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

JobiJoba avatar Jun 07 '25 22:06 JobiJoba

Looking at the code a bit deeper

String getFaceThumbnailUrl(final String personId) {
  return '${Store.get(StoreKey.serverEndpoint)}/people/$personId/thumbnail';
}

I assume that when we select a new picture for a person; it erases the old one from /personId/thumbnail and replace it. If it's true, we need to find something else to use as a CacheKey. I think I can try to pass down everywhere we need the thumbnailPath (only places where it's not easy is in the search result where there are some wrapping around the person)

flutter: 
imageURL: http://localhost:3000/api/people/5e995d67-79b2-472b-a09e-bb082464cbca/thumbnail 
thumbnailPath:  upload/thumbs/2a6f31c6-820f-4f47-b7b5-d131dc0486a7/5e/99/5e995d67-79b2-472b-a09e-bb082464cbca.jpeg

@shenlong-tanwen Do you agree?

JobiJoba avatar Jun 09 '25 10:06 JobiJoba

Hey I don't think we should merge that without fixing the comment before or else when people will change the picture it will only refresh when the cache will be cleared.

JobiJoba avatar Jun 17 '25 23:06 JobiJoba

Hey, I am going to close this for now due to it being stale for a while. If you find a way to resolve the cache key issue, then feel free to comment here to have it re-opened. If you need input from someone, feel free to ping them here too to get their input!

zackpollard avatar Jul 17 '25 14:07 zackpollard