diff --git a/event-schemas/examples/m.room.message#m.location b/event-schemas/examples/m.room.message#m.location index fcbeb97e..75363f6f 100644 --- a/event-schemas/examples/m.room.message#m.location +++ b/event-schemas/examples/m.room.message#m.location @@ -3,12 +3,14 @@ "content": { "body": "Big Ben, London, UK", "geo_uri": "geo:51.5008,0.1247", - "thumbnail_url": "mxc://localhost/FHyPlCeYUSFFxlgbQYZmoEoe", - "thumbnail_info": { - "mimetype": "image/jpeg", - "size": 46144, - "w": 300, - "h": 300 + "info": { + "thumbnail_url": "mxc://localhost/FHyPlCeYUSFFxlgbQYZmoEoe", + "thumbnail_info": { + "mimetype": "image/jpeg", + "size": 46144, + "w": 300, + "h": 300 + } }, "msgtype": "m.location" }, @@ -17,4 +19,4 @@ "room_id": "!jEsUZKDJdhlrceRyVU:localhost", "type": "m.room.message", "sender": "@example:localhost" -} +} diff --git a/event-schemas/schema/core-event-schema/msgtype_infos/image_info.yaml b/event-schemas/schema/core-event-schema/msgtype_infos/image_info.yaml index 7ef7a86f..b4eab413 100644 --- a/event-schemas/schema/core-event-schema/msgtype_infos/image_info.yaml +++ b/event-schemas/schema/core-event-schema/msgtype_infos/image_info.yaml @@ -4,13 +4,21 @@ properties: h: description: The height of the image in pixels. type: integer + w: + description: The width of the image in pixels. + type: integer mimetype: description: The mimetype of the image, e.g. ``image/jpeg``. type: string size: description: Size of the image in bytes. type: integer - w: - description: The width of the image in pixels. - type: integer + thumbnail_url: + description: The URL to a thumbnail of the image. + type: string + thumbnail_info: + allOf: + - $ref: thumbnail_info.yaml + description: Metadata about the image referred to in ``thumbnail_url``. title: ImageInfo +type: object diff --git a/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml b/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml new file mode 100644 index 00000000..5a233b24 --- /dev/null +++ b/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml @@ -0,0 +1,17 @@ +$schema: http://json-schema.org/draft-04/schema# +description: Metadata about a thumbnail image. +properties: + h: + description: The height of the image in pixels. + type: integer + w: + description: The width of the image in pixels. + type: integer + mimetype: + description: The mimetype of the image, e.g. ``image/jpeg``. + type: string + size: + description: Size of the image in bytes. + type: integer +title: ThumbnailInfo +type: object diff --git a/event-schemas/schema/m.room.avatar b/event-schemas/schema/m.room.avatar index f99ae285..a0ecb21c 100644 --- a/event-schemas/schema/m.room.avatar +++ b/event-schemas/schema/m.room.avatar @@ -9,17 +9,6 @@ properties: allOf: - $ref: core-event-schema/msgtype_infos/image_info.yaml description: Metadata about the image referred to in ``url``. - title: ImageInfo - type: object - thumbnail_info: - allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - description: Metadata about the image referred to in ``thumbnail_url``. - title: ImageInfo - type: object - thumbnail_url: - description: The URL to the thumbnail of the image. - type: string url: description: The URL to the image. type: string diff --git a/event-schemas/schema/m.room.message#m.file b/event-schemas/schema/m.room.message#m.file index 2f56c804..76e59e09 100644 --- a/event-schemas/schema/m.room.message#m.file +++ b/event-schemas/schema/m.room.message#m.file @@ -20,21 +20,19 @@ properties: size: description: The size of the file in bytes. type: integer + thumbnail_url: + description: The URL to the thumbnail of the file. + type: string + thumbnail_info: + allOf: + - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml + description: Metadata about the image referred to in ``thumbnail_url``. title: FileInfo type: object msgtype: enum: - m.file type: string - thumbnail_info: - allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - description: Metadata about the image referred to in ``thumbnail_url``. - title: ImageInfo - type: object - thumbnail_url: - description: The URL to the thumbnail of the file. - type: string url: description: The URL to the file. type: string diff --git a/event-schemas/schema/m.room.message#m.image b/event-schemas/schema/m.room.message#m.image index 4573ff27..1237b8f8 100644 --- a/event-schemas/schema/m.room.message#m.image +++ b/event-schemas/schema/m.room.message#m.image @@ -9,35 +9,13 @@ properties: description: "A textual representation of the image. This could be the alt text of the image, the filename of the image, or some kind of content description for accessibility e.g. 'image attachment'." type: string info: + allOf: + - $ref: core-event-schema/msgtype_infos/image_info.yaml description: Metadata about the image referred to in ``url``. - properties: - h: - description: The height of the image in pixels. - type: integer - mimetype: - description: 'The mimetype of the image, e.g. ``image/jpeg``.' - type: string - size: - description: Size of the image in bytes. - type: integer - w: - description: The width of the image in pixels. - type: integer - title: ImageInfo - type: object msgtype: enum: - m.image type: string - thumbnail_info: - allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - description: Metadata about the image referred to in ``thumbnail_url``. - title: ImageInfo - type: object - thumbnail_url: - description: The URL to the thumbnail of the image. - type: string url: description: The URL to the image. type: string diff --git a/event-schemas/schema/m.room.message#m.location b/event-schemas/schema/m.room.message#m.location index ca37856d..e8d55769 100644 --- a/event-schemas/schema/m.room.message#m.location +++ b/event-schemas/schema/m.room.message#m.location @@ -15,14 +15,17 @@ properties: enum: - m.location type: string - thumbnail_info: - allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - title: ImageInfo + info: type: object - thumbnail_url: - description: The URL to a thumbnail of the location being represented. - type: string + properties: + thumbnail_url: + description: The URL to a thumbnail of the location being represented. + type: string + thumbnail_info: + allOf: + - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml + description: Metadata about the image referred to in ``thumbnail_url``. + title: LocationInfo required: - msgtype - body diff --git a/event-schemas/schema/m.room.message#m.video b/event-schemas/schema/m.room.message#m.video index 09753965..a0240b54 100644 --- a/event-schemas/schema/m.room.message#m.video +++ b/event-schemas/schema/m.room.message#m.video @@ -17,23 +17,22 @@ properties: h: description: The height of the video in pixels. type: integer + w: + description: The width of the video in pixels. + type: integer mimetype: description: The mimetype of the video e.g. ``video/mp4``. type: string size: description: The size of the video in bytes. type: integer - thumbnail_info: - allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - title: ImageInfo - type: object thumbnail_url: - description: The URL to a thumbnail of the video clip. + description: The URL to an image thumbnail of the video clip. type: string - w: - description: The width of the video in pixels. - type: integer + thumbnail_info: + allOf: + - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml + description: Metadata about the image referred to in ``thumbnail_url``. title: VideoInfo type: object msgtype: diff --git a/specification/modules/instant_messaging.rst b/specification/modules/instant_messaging.rst index 11595b70..342050a7 100644 --- a/specification/modules/instant_messaging.rst +++ b/specification/modules/instant_messaging.rst @@ -71,6 +71,12 @@ Events which have attachments (e.g. ``m.image``, ``m.file``) SHOULD be uploaded using the `content repository module`_ where available. The resulting ``mxc://`` URI can then be used in the ``url`` key. +Clients MAY include a client generated thumbnail image for an attachment under +a ``info.thumbnail_url`` key. The thumbnail SHOULD also be a ``mxc://`` URI. +Clients displaying events with attachments can either use the client generated +thumbnail or ask its homeserver to generate a thumbnail from the original +attachment using the `content repository module`_. + .. _`content repository module`: `module:content`_ Recommendations when sending messages