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
This commit is contained in:
lomion 2021-02-17 12:54:35 +01:00
parent 92f89dc9a8
commit 91ac13cf29

View file

@ -75,13 +75,14 @@ class TmdbBot(Plugin):
async def send_image(self, evt: MessageEvent, title, image) -> None: async def send_image(self, evt: MessageEvent, title, image) -> None:
if image: if image:
mxc_uri = await self.client.upload_media(image) mxc_uri = await self.client.upload_media(image, mime_type='image/jpg')
content = MediaMessageEventContent( content = MediaMessageEventContent(
msgtype=MessageType.IMAGE, msgtype=MessageType.IMAGE,
body=f"Image {title}", body=f"Image {title}",
url=f"{mxc_uri}", url=f"{mxc_uri}",
info=ImageInfo(mimetype='image/jpg')) info=ImageInfo(mimetype='image/jpg'))
await evt.respond(content) 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: def construct_html_message(self, movie, overview_length = 200, cast_length = 3) -> str:
if len(movie.overview) > overview_length: if len(movie.overview) > overview_length: