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

Index primary thumbnail id #304

Merged
merged 6 commits into from
Feb 12, 2025
Merged

Index primary thumbnail id #304

merged 6 commits into from
Feb 12, 2025

Conversation

eliotjordan
Copy link
Member

@eliotjordan eliotjordan commented Feb 11, 2025

Closes #159

  • Extract thumbnail url
  • Render large show page thumbnail using thumbnail service url
  • Handle thumbnail ids that do not correspond to FileSets
  • Render primary thumbnail first and limit total thumbnails

Search and show page before

Screenshot 2025-02-11 at 4 06 51 PM
Screenshot 2025-02-11 at 4 06 25 PM
Screenshot 2025-02-11 at 4 08 13 PM

Updating the resource thumbnail

Screenshot 2025-02-11 at 4 07 15 PM

After updating

Screenshot 2025-02-11 at 4 08 21 PM
Screenshot 2025-02-11 at 4 08 07 PM
Screenshot 2025-02-11 at 4 08 13 PM

Copy link

github-actions bot commented Feb 11, 2025

Container Scanning Status: ✅ Success


ghcr.io/pulibrary/dpul-collections:pr-304 (debian 12.6)
=======================================================
Total: 0 (HIGH: 0, CRITICAL: 0)

tpendragon
tpendragon previously approved these changes Feb 12, 2025
Copy link
Contributor

@tpendragon tpendragon left a comment

Choose a reason for hiding this comment

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

One non-blocking question. You can either look at it or merge, I'm okay either way.

}
end

defp primary_thumbnail_service_url(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if it's more readable, but I wonder if a bunch of these conditionals are pattern matchable?

Like

defp primary_thumbnail_service_url(%{"thumbnail_id" => [%{"id" => id}], %{"member_ids" => %{id => stuff}})

for the case where there's an id key (this might not be possible, I dunno if you can match like this...)

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried similar approaches and could not get matches to happen.

defp thumbnail_service_urls(max_thumbnails, image_service_urls, nil) do
# Truncate image service urls to max value
image_service_urls
|> Enum.slice(0, max_thumbnails)
Copy link
Contributor

Choose a reason for hiding this comment

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

😂 Yeah I was wondering about this, were we just putting every thumbnail on the page? I guess it was performing.

Copy link
Member

@hackartisan hackartisan left a comment

Choose a reason for hiding this comment

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

Very thorough, thank you. I didn't even realize we could have things with multiple thumbnails!

Left requests about comments inline.

@hackartisan hackartisan merged commit 5cefde4 into main Feb 12, 2025
4 checks passed
@hackartisan hackartisan deleted the 159-index-thumbnail branch February 12, 2025 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Index the thumbnail
3 participants