Skip to content

Commit 9b43cc4

Browse files
committed
Fixing scenario where a JPG/GIF thumbnail is created with padding, resulting thumbnail needs to be saved as a PNG. For stephenmcd#1925
1 parent cf6c79c commit 9b43cc4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mezzanine/core/templatetags/mezzanine_tags.py

+5
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,11 @@ def thumbnail(image_url, width, height, upscale=True, quality=95, left=.5,
416416
pad_container = Image.new("RGBA", pad_size, padding_color)
417417
pad_container.paste(image, (pad_left, pad_top))
418418
image = pad_container
419+
# Make thumbnail a PNG - required if original isn't one
420+
if filetype != "PNG":
421+
filetype = "PNG"
422+
thumb_path += ".png"
423+
thumb_url += ".png"
419424

420425
# Create the thumbnail.
421426
to_size = (to_width, to_height)

0 commit comments

Comments
 (0)