Hi,

a couple of reason that speak against using the HTTP upload to create
thumbnails. (In no particular order)

- the service should be agnostic towards the files. I assume you are
proposing to create thumbnails for images? What about video files? what
about images in exotic formats? do I know before hand if the server will
create a thumbnail for me? Will this be random? do you add a way to
discover 'known image formats'?
- in an idealistic world we will have more and more end-to-end encryption.
so any thumbnail creation will not work for those images. so clients that
handle end-to-end encryption will have to provide a way to create their own
thumbnails anyway.
- potential security leaks. For a server it is much safer just to copy
files and store them than to actually process them. media formats have a
long history of being exploitable.
- very little actual gain. creating a thumbnail is not that expensive.
especially since your device is probably awake at this point anyway. If the
thumbnail creation will freeze your UI is probably up to your
implementation and can probably be avoided in most cases. the only small
benefit would be that you don't have to upload the actual thumbnail. but
considering that thumbnails are small... It don't really see it.

besides as of right now we don't have a proper way to send thumbnails
anyway. If we come up with a way to send thumbnails as dedicated thumbnails
it might be worth considering to send them base64 encoded inband anyway.
(right in the message stanza (you have to keep them smaller than lets say
5KiB but for thumbnails thats probably manageable)

cheers
Daniel

2015-09-03 13:11 GMT+02:00 Evgeny Khramtsov <[email protected]>:

> Thu, 27 Aug 2015 16:10:18 +0000 (UTC)
> XMPP Extensions Editor <[email protected]> wrote:
>
> > Version 0.1 of XEP-0363 (HTTP File Upload) has been released.
> >
> > Abstract: This specification defines a protocol to request
> > permissions from another entity to upload a file to a specific path
> > on an HTTP server and at the same time receive a URL from which that
> > file can later be downloaded again.
> >
> > Changelog: Initial published version approved by the XMPP Council.
> > (XEP Editor (mam))
> >
> > Diff: http://xmpp.org/extensions/diff/api/xep/0363/diff/0.1/vs/0.1
> >
> > URL: http://xmpp.org/extensions/xep-0363.html
> >
>
> It would be great if the protocol supports image thumbnails
> (optionally). A server could generate thumbnails during upload so a
> client don't need to convert image locally. This will reduce
> cpu/battery usage on mobile devices, simplify clients code and will
> prevent UI from freezing during image transformation). I think
> there are two ways implementing it:
>
> 1) The thumbnail SHOULD be returned with HTTP response, e.g.:
> HTTP/1.1 200 OK
> Content-Type: text/xml
> ...
> <thumbnail xmlns='urn:xmpp:thumbs:1'
>    uri='
> https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/thumb.png
> '
>    media-type='image/png'
>    width='128'
>    height='96'/>
>
> (the <thumnail/> element is described in XEP-0264)
>
> 2) Another way is introducing new stanza which will be sent by an XMPP
> server when upload is complete, for example:
>
> <iq from='upload.montague.tld
>     id='step_03'
>     to='[email protected]/garden
>     type='set'>
>   <response xmlns='urn:xmpp:http:upload'>
>     <thumbnail xmlns='urn:xmpp:thumbs:1'
>                      uri='
> cid:[email protected]'
>                      media-type='image/png'
>                      width='128'
>                      height='96'/>
>   </response>
> </iq>
>
> Also, <response/> element could be extended to notify a client about
> upload status.
>
> This thumbnail then can be put into file-transfer offer using either
> jingle http transport protoXEP or directly into jabber:x:oob message,
> e.g:
>
> <message
>     from='[email protected]/firstwitch'
>     id='162BEBB1-F6DB-4D9A-9BD8-CFDCC801A0B2'
>     to='[email protected]/broom'
>     type='groupchat'>
>   <body>
> https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png
> </body>
>   <x xmlns='jabber:x:oob'>
>     <url>
> https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png
> </url>
>     <desc>file</desc>
>     <thumbnail xmlns='urn:xmpp:thumbs:1'
>                      uri='
> https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/thumb.png
> '
>                      media-type='image/png'
>                      width='128'
>                      height='96'/>
>
>   </x>
> </message>
>

Reply via email to