From 91ac13cf2963d27ce9a7616e1554d37c8f9e8bd2 Mon Sep 17 00:00:00 2001 From: lomion Date: Wed, 17 Feb 2021 12:54:35 +0100 Subject: [PATCH] Forced image upload to mimetype "image/jpg" Test result: Image download working with all clients. Image preview is working with Element Android and FluffyChat but not in Element Web. Todo: Get mimetype from downloaded image or make sure its always jpg --- tmdb/tmdb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tmdb/tmdb.py b/tmdb/tmdb.py index b00f293..9564f33 100644 --- a/tmdb/tmdb.py +++ b/tmdb/tmdb.py @@ -75,13 +75,14 @@ class TmdbBot(Plugin): async def send_image(self, evt: MessageEvent, title, image) -> None: if image: - mxc_uri = await self.client.upload_media(image) + mxc_uri = await self.client.upload_media(image, mime_type='image/jpg') content = MediaMessageEventContent( msgtype=MessageType.IMAGE, body=f"Image {title}", url=f"{mxc_uri}", info=ImageInfo(mimetype='image/jpg')) await evt.respond(content) + #await self.client.send_image(evt.room_id, url=mxc_uri, info=ImageInfo(mimetype='image/jpg')) def construct_html_message(self, movie, overview_length = 200, cast_length = 3) -> str: if len(movie.overview) > overview_length: