Check that image dimensions are returned

main
Bob Mottram 2024-07-25 14:54:31 +01:00
parent b70ae582d9
commit 19160226a9
1 changed files with 4 additions and 0 deletions

View File

@ -782,8 +782,12 @@ def apply_watermark_to_image(base_dir: str, nickname: str, domain: str,
# scale the watermark so that it is a fixed percentage of the image width
post_image_width, _ = \
get_image_dimensions(post_image_filename)
if not post_image_width:
return False
watermark_image_width, watermark_image_height = \
get_image_dimensions(post_image_filename)
if not watermark_image_width or not watermark_image_height:
return False
scaled_watermark_image_width = \
int(post_image_width * watermark_width_percent / 100)
scaled_watermark_image_height = \