Browse Source

Add JPEG support to site icon downloader

I didn't know if this would ever be used, and then a topic was posted
almost immediately that needed it.
merge-requests/40/head
Deimos 6 years ago
parent
commit
9056a71013
  1. 4
      tildes/consumers/site_icon_downloader.py

4
tildes/consumers/site_icon_downloader.py

@ -84,14 +84,14 @@ class SiteIconDownloader(PgsqlQueueConsumer):
image = favicon.ico.getimage(max(favicon.ico.sizes())) image = favicon.ico.getimage(max(favicon.ico.sizes()))
return image.resize((32, 32)) return image.resize((32, 32))
elif favicon.format == "PNG":
elif favicon.format in ("JPEG", "PNG"):
image = favicon image = favicon
if image.size != (32, 32): if image.size != (32, 32):
image = image.resize((32, 32)) image = image.resize((32, 32))
return image return image
# formats other than ICO or PNG aren't handled
# any other formats aren't handled
return None return None

Loading…
Cancel
Save