Check-in [a888486bae]
Overview
| Comment: | Add binary JPEG detection \xFF\xD8\xFF magic bytes. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
a888486bae2a70bb7b804e6430920113 |
| User & Date: | mario on 2020-05-14 23:05:11 |
| Other Links: | manifest | tags |
Context
|
2020-05-14
| ||
| 23:05 | Support for LiveRadio.UK (in addition to .IE) check-in: 3aa88ef2ca user: mario tags: trunk | |
| 23:05 | Add binary JPEG detection \xFF\xD8\xFF magic bytes. check-in: a888486bae user: mario tags: trunk | |
|
2020-05-13
| ||
| 18:59 | Add .click() counting callback. check-in: 68bbdda1e4 user: mario tags: trunk | |
Changes
Modified channels/favicon.py from [81d5a0ff38] to [e380c77c1c].
| ︙ | ︙ | |||
299 300 301 302 303 304 305 |
# Check for valid image binary, possibly convert or resize, then save to cache filename
def store_image(imgdata, fn, resize=None):
# Convert accepted formats -- even PNG for filtering now
| | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# Check for valid image binary, possibly convert or resize, then save to cache filename
def store_image(imgdata, fn, resize=None):
# Convert accepted formats -- even PNG for filtering now
if re.match(br'^(.PNG|GIF\d+|.{0,15}(Exif|JFIF)|\x00\x00\x01\x00|\xFF\xD8\xFF|.{0,255}<svg[^>]+svg)', imgdata):
try:
# Read from byte/str
image = Image.open(BytesIO(imgdata))
log.FAVICON_IMAGE_TO_PNG(image, image.size, resize)
# Resize
if resize and image.size[0] > resize:
|
| ︙ | ︙ |