Closes #20211: Use thumbnails for ImageAttachment hover previews to improve page load performance #394

Closed
opened 2026-04-05 16:29:18 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @pheus on 2/9/2026

Fixes: #20211

Thanks for taking the time to review this PR!

This PR addresses the performance issue described in #20211, where object pages preload full-size image attachments for the hover preview. With the addition of image thumbnails in NetBox 4.4, we can use those smaller images for the popover preview instead, which reduces bandwidth usage and improves initial page load time (especially on pages with multiple large image attachments).

Summary of changes

Previews now prefer a lightweight data-preview-url (thumbnail) with a fallback to the link href, reducing bandwidth and improving page load performance for records with large image attachments.

  • Use 400x400 thumbnails for popover previews
  • Center preview images within the popover body
  • Move popover placement from top to left
  • Enable lazy loading and async decoding for preview images

Notes

  • Clicking the image icon navigates to the attachment detail view.
  • The behavior is backwards-compatible: if data-preview-url is not present, the preview falls back to href as before.

Please let me know if you’d prefer a different thumbnail size or popover placement, or if there’s a more appropriate SCSS location for the styling changes. Happy to adjust.

*Originally created by @pheus on 2/9/2026* ### Fixes: #20211 Thanks for taking the time to review this PR! This PR addresses the performance issue described in #20211, where object pages preload full-size image attachments for the hover preview. With the addition of image thumbnails in NetBox 4.4, we can use those smaller images for the popover preview instead, which reduces bandwidth usage and improves initial page load time (especially on pages with multiple large image attachments). #### Summary of changes Previews now prefer a lightweight `data-preview-url` (thumbnail) with a fallback to the link `href`, reducing bandwidth and improving page load performance for records with large image attachments. - Use 400x400 thumbnails for popover previews - Center preview images within the popover body - Move popover placement from top to left - Enable lazy loading and async decoding for preview images #### Notes - Clicking the image icon navigates to the attachment detail view. - The behavior is backwards-compatible: if `data-preview-url` is not present, the preview falls back to `href` as before. Please let me know if you’d prefer a different thumbnail size or popover placement, or if there’s a more appropriate SCSS location for the styling changes. Happy to adjust.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#394