From 89bee5e6b2872f709e498987263ff5bc789fbaa7 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Mon, 30 Apr 2018 04:07:08 +0200 Subject: [PATCH] use direct io for mastodon images --- screenless/bureau/publicrelations/publicrelations.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/screenless/bureau/publicrelations/publicrelations.py b/screenless/bureau/publicrelations/publicrelations.py index e4d7a9c..21d09f8 100644 --- a/screenless/bureau/publicrelations/publicrelations.py +++ b/screenless/bureau/publicrelations/publicrelations.py @@ -299,11 +299,11 @@ class PublicRelations(Bureau): if media.type == "image": img = media if img: - filename = img.url.rsplit('/',1)[1] - filename = "/tmp/" + filename - print("fetching", img.remote_url, filename) + #filename = img.url.rsplit('/',1)[1] + #filename = "/tmp/" + filename + #print("fetching", img.remote_url, filename) req_data = requests.get(img.url) - im = PIL.Image.open(io.StringIO(filename)) + im = PIL.Image.open(io.StringIO(req_data.content)) if im.mode in ("L", "RGB", "P"): im = PIL.ImageOps.equalize(im) im.thumbnail((576, 576), PIL.Image.ANTIALIAS)