[PR #20359] [MERGED] Fixes #20298: Add placeholder for failed image thumbnail generation #15907

Closed
opened 2025-12-30 00:24:44 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20359
Author: @jnovinger
Created: 9/15/2025
Status: Merged
Merged: 9/16/2025
Merged by: @arthanson

Base: mainHead: 20298-placeholder-image


📝 Commits (1)

  • 6d078f8 Fixes #20298: Add placeholder for failed image thumbnail generation

📊 Changes

1 file changed (+10 additions, -0 deletions)

View changed files

📝 netbox/templates/extras/object_imageattachments.html (+10 -0)

📄 Description

Fixes: #20298

When Redis cache lacks disk persistence sorl-thumbnail fails to generate thumbnails, leaving only bare filename text visible. This adds an {% empty %} fallback block to the thumbnail template that displays a placeholder with a broken image icon and user instructions when thumbnail generation fails.

The placeholder maintains the expected 200x200px dimensions and provides:

  • Broken image icon (mdi-image-broken-variant)
  • Error message explaining the issue
  • Clickable link to view the original image
  • High contrast text (text-dark) for readability on light background

This can be tested by changing the permission on the thumbnail cache directory before adding a thumbnail, via chmod 444 netbox/media/cache. Just remember to change the permission back after testing.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20359 **Author:** [@jnovinger](https://github.com/jnovinger) **Created:** 9/15/2025 **Status:** ✅ Merged **Merged:** 9/16/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `main` ← **Head:** `20298-placeholder-image` --- ### 📝 Commits (1) - [`6d078f8`](https://github.com/netbox-community/netbox/commit/6d078f8768adba4df04c16499509ef8625716048) Fixes #20298: Add placeholder for failed image thumbnail generation ### 📊 Changes **1 file changed** (+10 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/templates/extras/object_imageattachments.html` (+10 -0) </details> ### 📄 Description ### Fixes: #20298 When Redis cache lacks disk persistence `sorl-thumbnail` fails to generate thumbnails, leaving only bare filename text visible. This adds an `{% empty %}` fallback block to the thumbnail template that displays a placeholder with a broken image icon and user instructions when thumbnail generation fails. The placeholder maintains the expected 200x200px dimensions and provides: - Broken image icon (`mdi-image-broken-variant`) - Error message explaining the issue - Clickable link to view the original image - High contrast text (`text-dark`) for readability on light background This can be tested by changing the permission on the thumbnail cache directory before adding a thumbnail, via `chmod 444 netbox/media/cache`. Just remember to change the permission back after testing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:24:44 +01:00
adam closed this issue 2025-12-30 00:24:44 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15907