Add info for matrix image messages #2228
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds image info (mtype, width, height) to the matrix message. It uses b.mc.SendMessageEvent instead of b.mc.SendImage to include the info part.
Images sent to matrix get shown in element but when using mautrix (signal) bridge to further forward the image it does not get recognized as image but is being treated as file.
Fileinfo is optional (https://spec.matrix.org/v1.14/client-server-api/#mimage).
There are different options dealing with metainfo:
To properly display images in signal mautrix signal could be changed to accept image messages without imageinfo (c), or gomatrix could include this (b1) (archived repo: https://github.com/matrix-org/gomatrix so no changes to be expected here) or it can be implemented here (b2). I decided to go for the latter. It works for me.
I am dealing with messages from telegram bridged to matrix. The telegram message includes the width and height. It would even be possible to forward this metainformation through matterbridge (a) but I did not see an easy way to accomplish this.