From 6d078f8768adba4df04c16499509ef8625716048 Mon Sep 17 00:00:00 2001 From: Jason Novinger Date: Mon, 15 Sep 2025 14:55:03 -0500 Subject: [PATCH] Fixes #20298: Add placeholder for failed image thumbnail generation 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 --- netbox/templates/extras/object_imageattachments.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/netbox/templates/extras/object_imageattachments.html b/netbox/templates/extras/object_imageattachments.html index 9c3c137a9..981927d45 100644 --- a/netbox/templates/extras/object_imageattachments.html +++ b/netbox/templates/extras/object_imageattachments.html @@ -27,6 +27,16 @@ alt="{{ object.description|default:object.name }}" /> + {% empty %} + +
+
+ +
{% trans "Thumbnail cannot be generated" %}
+
{% trans "Click to view original" %}
+
+
+
{% endthumbnail %}
{{ object }}