From 25b41c755139ab39d15c42078cd825db4c7d08b0 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 4 Nov 2016 14:52:01 +0000 Subject: [PATCH 01/12] Move m.image thumbnail_url to be inside info to match m.video --- event-schemas/schema/m.room.message#m.image | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/event-schemas/schema/m.room.message#m.image b/event-schemas/schema/m.room.message#m.image index 4573ff27..26fb0ee4 100644 --- a/event-schemas/schema/m.room.message#m.image +++ b/event-schemas/schema/m.room.message#m.image @@ -23,21 +23,21 @@ properties: w: description: The width of the image in pixels. type: integer + 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 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 From 14d05464eef232c751f14737946915db40238320 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 4 Nov 2016 14:53:59 +0000 Subject: [PATCH 02/12] Move m.file thumbnail_url to be inside info to match m.video --- event-schemas/schema/m.room.message#m.file | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/event-schemas/schema/m.room.message#m.file b/event-schemas/schema/m.room.message#m.file index 2f56c804..68a355cc 100644 --- a/event-schemas/schema/m.room.message#m.file +++ b/event-schemas/schema/m.room.message#m.file @@ -20,21 +20,21 @@ properties: size: description: The size of the file in bytes. type: integer + 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 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 From 1b661b64dc380b241b50f83ac34b884c82ef9c66 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 4 Nov 2016 14:59:39 +0000 Subject: [PATCH 03/12] Move m.location thumbnail_url to be inside info to match m.video --- event-schemas/schema/m.room.message#m.location | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/event-schemas/schema/m.room.message#m.location b/event-schemas/schema/m.room.message#m.location index ca37856d..14ee97fb 100644 --- a/event-schemas/schema/m.room.message#m.location +++ b/event-schemas/schema/m.room.message#m.location @@ -15,14 +15,18 @@ 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_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 location being represented. + type: string + title: LocationInfo required: - msgtype - body From 2fdca5a995621d40478b73d06aefdf5507dffbd6 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 7 Nov 2016 10:50:52 +0000 Subject: [PATCH 04/12] Add a thumbnail_info common schema, deduplicate m.room.avatar and m.room.message#m.image --- .../msgtype_infos/image_info.yaml | 9 +++++++ .../msgtype_infos/thumbnail_info.yaml | 16 +++++++++++++ event-schemas/schema/m.room.avatar | 9 ------- event-schemas/schema/m.room.message#m.file | 4 ++-- event-schemas/schema/m.room.message#m.image | 24 ++----------------- .../schema/m.room.message#m.location | 4 ++-- event-schemas/schema/m.room.message#m.video | 4 ++-- 7 files changed, 33 insertions(+), 37 deletions(-) create mode 100644 event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml 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..6d72f223 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 @@ -13,4 +13,13 @@ properties: w: description: The width of the image in pixels. type: integer + thumbnail_url: + desciption: The URL to a thumbnail of the image. + 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: ThumbnailInfo + type: object title: ImageInfo 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..1daea3fc --- /dev/null +++ b/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml @@ -0,0 +1,16 @@ +$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 + 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: ThumbnailInfo diff --git a/event-schemas/schema/m.room.avatar b/event-schemas/schema/m.room.avatar index f99ae285..94107641 100644 --- a/event-schemas/schema/m.room.avatar +++ b/event-schemas/schema/m.room.avatar @@ -11,15 +11,6 @@ properties: 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 68a355cc..84dc2041 100644 --- a/event-schemas/schema/m.room.message#m.file +++ b/event-schemas/schema/m.room.message#m.file @@ -22,9 +22,9 @@ properties: type: integer thumbnail_info: allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml + - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml description: Metadata about the image referred to in ``thumbnail_url``. - title: ImageInfo + title: ThumbnailInfo type: object thumbnail_url: description: The URL to the thumbnail of the file. diff --git a/event-schemas/schema/m.room.message#m.image b/event-schemas/schema/m.room.message#m.image index 26fb0ee4..24857d94 100644 --- a/event-schemas/schema/m.room.message#m.image +++ b/event-schemas/schema/m.room.message#m.image @@ -9,29 +9,9 @@ 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 - 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 title: ImageInfo type: object msgtype: diff --git a/event-schemas/schema/m.room.message#m.location b/event-schemas/schema/m.room.message#m.location index 14ee97fb..150c3924 100644 --- a/event-schemas/schema/m.room.message#m.location +++ b/event-schemas/schema/m.room.message#m.location @@ -20,8 +20,8 @@ properties: properties: thumbnail_info: allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - title: ImageInfo + - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml + title: ThumbnailInfo type: object thumbnail_url: description: The URL to a thumbnail of the location being represented. diff --git a/event-schemas/schema/m.room.message#m.video b/event-schemas/schema/m.room.message#m.video index 09753965..6f520ac2 100644 --- a/event-schemas/schema/m.room.message#m.video +++ b/event-schemas/schema/m.room.message#m.video @@ -25,8 +25,8 @@ properties: type: integer thumbnail_info: allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - title: ImageInfo + - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml + title: ThumbnailInfo type: object thumbnail_url: description: The URL to a thumbnail of the video clip. From 434998218904d66c8b953d4d8f0d0b04c40ed9e2 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 7 Nov 2016 10:54:02 +0000 Subject: [PATCH 05/12] Fix path --- .../schema/core-event-schema/msgtype_infos/image_info.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6d72f223..8920f58c 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 @@ -18,7 +18,7 @@ properties: type: string thumbnail_info: allOf: - - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml + - $ref: thumbnail_info.yaml description: Metadata about the image referred to in ``thumbnail_url``. title: ThumbnailInfo type: object From 6ecb5d072932fe731b2bedd5c34c0cf95dc07f01 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 7 Nov 2016 14:28:19 +0000 Subject: [PATCH 06/12] re-order thumbnail keys --- event-schemas/schema/m.room.message#m.file | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/event-schemas/schema/m.room.message#m.file b/event-schemas/schema/m.room.message#m.file index 84dc2041..17cc577d 100644 --- a/event-schemas/schema/m.room.message#m.file +++ b/event-schemas/schema/m.room.message#m.file @@ -20,15 +20,15 @@ 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: ThumbnailInfo type: object - thumbnail_url: - description: The URL to the thumbnail of the file. - type: string title: FileInfo type: object msgtype: From 5ccf41bafc6a2050cadb7473231bb79e02d20745 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 7 Nov 2016 14:29:17 +0000 Subject: [PATCH 07/12] Add type: object --- .../schema/core-event-schema/msgtype_infos/thumbnail_info.yaml | 1 + 1 file changed, 1 insertion(+) 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 index 1daea3fc..30ee4a24 100644 --- a/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml +++ b/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml @@ -14,3 +14,4 @@ properties: description: The width of the image in pixels. type: integer title: ThumbnailInfo +type: object From 30f9ea02251624f75aa73526186f8193105e3c57 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 7 Nov 2016 14:30:16 +0000 Subject: [PATCH 08/12] Spelling --- .../schema/core-event-schema/msgtype_infos/image_info.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8920f58c..05d04e0b 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 @@ -14,7 +14,7 @@ properties: description: The width of the image in pixels. type: integer thumbnail_url: - desciption: The URL to a thumbnail of the image. + description: The URL to a thumbnail of the image. type: string thumbnail_info: allOf: From 29e33deeb50fdf32a54f3fddc0f59a71e81c287a Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 7 Nov 2016 14:31:29 +0000 Subject: [PATCH 09/12] Fix m.location example --- event-schemas/examples/m.room.message#m.location | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/event-schemas/examples/m.room.message#m.location b/event-schemas/examples/m.room.message#m.location index fcbeb97e..dad2385f 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" }, From 05001bcaa689ef86df23f05fef17b0c3cbab3356 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 7 Nov 2016 14:32:48 +0000 Subject: [PATCH 10/12] Fix whitepace --- event-schemas/examples/m.room.message#m.location | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event-schemas/examples/m.room.message#m.location b/event-schemas/examples/m.room.message#m.location index dad2385f..75363f6f 100644 --- a/event-schemas/examples/m.room.message#m.location +++ b/event-schemas/examples/m.room.message#m.location @@ -19,4 +19,4 @@ "room_id": "!jEsUZKDJdhlrceRyVU:localhost", "type": "m.room.message", "sender": "@example:localhost" -} +} From 6f1c598db82f32a9f217094b2014ba471c0c5b3a Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 7 Nov 2016 14:54:59 +0000 Subject: [PATCH 11/12] Make the key orders consistent --- .../msgtype_infos/image_info.yaml | 9 ++++----- .../msgtype_infos/thumbnail_info.yaml | 6 +++--- event-schemas/schema/m.room.avatar | 2 -- event-schemas/schema/m.room.message#m.file | 2 -- event-schemas/schema/m.room.message#m.image | 2 -- event-schemas/schema/m.room.message#m.location | 9 ++++----- event-schemas/schema/m.room.message#m.video | 15 +++++++-------- 7 files changed, 18 insertions(+), 27 deletions(-) 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 05d04e0b..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,15 +4,15 @@ 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 @@ -20,6 +20,5 @@ properties: allOf: - $ref: thumbnail_info.yaml description: Metadata about the image referred to in ``thumbnail_url``. - title: ThumbnailInfo - type: object 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 index 30ee4a24..5a233b24 100644 --- a/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml +++ b/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml @@ -4,14 +4,14 @@ 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 title: ThumbnailInfo type: object diff --git a/event-schemas/schema/m.room.avatar b/event-schemas/schema/m.room.avatar index 94107641..a0ecb21c 100644 --- a/event-schemas/schema/m.room.avatar +++ b/event-schemas/schema/m.room.avatar @@ -9,8 +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 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 17cc577d..76e59e09 100644 --- a/event-schemas/schema/m.room.message#m.file +++ b/event-schemas/schema/m.room.message#m.file @@ -27,8 +27,6 @@ properties: allOf: - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml description: Metadata about the image referred to in ``thumbnail_url``. - title: ThumbnailInfo - type: object title: FileInfo type: object msgtype: diff --git a/event-schemas/schema/m.room.message#m.image b/event-schemas/schema/m.room.message#m.image index 24857d94..1237b8f8 100644 --- a/event-schemas/schema/m.room.message#m.image +++ b/event-schemas/schema/m.room.message#m.image @@ -12,8 +12,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 msgtype: enum: - m.image diff --git a/event-schemas/schema/m.room.message#m.location b/event-schemas/schema/m.room.message#m.location index 150c3924..e8d55769 100644 --- a/event-schemas/schema/m.room.message#m.location +++ b/event-schemas/schema/m.room.message#m.location @@ -18,14 +18,13 @@ properties: info: type: object properties: - thumbnail_info: - allOf: - - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml - title: ThumbnailInfo - type: object 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 diff --git a/event-schemas/schema/m.room.message#m.video b/event-schemas/schema/m.room.message#m.video index 6f520ac2..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_url: + description: The URL to an image thumbnail of the video clip. + type: string thumbnail_info: allOf: - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml - title: ThumbnailInfo - type: object - thumbnail_url: - description: The URL to a thumbnail of the video clip. - type: string - w: - description: The width of the video in pixels. - type: integer + description: Metadata about the image referred to in ``thumbnail_url``. title: VideoInfo type: object msgtype: From 7025793ca85ec928a163fa83a4c94268c30fb32a Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 7 Nov 2016 16:17:25 +0000 Subject: [PATCH 12/12] Say that thumbnails should be 'mxc://' --- specification/modules/instant_messaging.rst | 6 ++++++ 1 file changed, 6 insertions(+) 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