Skip to content

Commit fa66bff

Browse files
committed
log if thumbnailing of image fails
1 parent 10db70c commit fa66bff

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

finder/contrib/image/models.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from logging import getLogger
12
from pathlib import Path
23

34
from django.conf import settings
@@ -8,6 +9,8 @@
89
from finder.models.file import AbstractFileModel
910

1011

12+
logger = getLogger(__name__)
13+
1114
GravityChoices = {
1215
'': "Center",
1316
'n': "North",
@@ -44,8 +47,8 @@ def get_thumbnail_url(self, realm):
4447
if not realm.sample_storage.exists(thumbnail_path):
4548
try:
4649
self.crop(realm, thumbnail_path, self.thumbnail_size, self.thumbnail_size)
47-
except Exception:
48-
# no thumbnail image could not be created
50+
except Exception as exception:
51+
logger.warning(f"Thumbnail generation failed for image {self.pk}: {exception}")
4952
return self.fallback_thumbnail_url
5053
return realm.sample_storage.url(thumbnail_path)
5154

0 commit comments

Comments
 (0)