4

I am dubious about the approach usually followed by popular Chat applications like Whatsapp, Wechat etc. It is seen that these apps share a low -resolution blurred out image of the actual image/video file. How is this managed?

My concern is the space management at the server end. Does the client process the original image and create a low-res version and sends 2 requests (Original+blurred file) to the server? Following which, the blurred image being lower in size is shared with others who trigger a GET request for the original image/video file.

Or does the server itself does some processing one the Original file received and make a low-res version out of it. And proceeds as above.

In both cases i could think of, space is being eaten up at the server end with 2 instances of each image/video being shared.

Kindly let me know how this is genrally carried out. Would be grateful!

bit_by_bit
  • 337
  • 2
  • 14
  • As I know they have 2 images, which is user profile image on top bar like 40x40, so when you go to see big view first they stretch that image which look like low res till they download the actual one, in image sending they also send first very low res image then the actual one. Some more advanced chat engine calculate the your network speed and send the first payload image based on that. – Retro Apr 07 '15 at 09:41
  • The issue is unless the download begins, the receiving clients would not know at all how the blurred version of the original image looks. Even to stretch the pixels would involve downloading of the image itself first right? – bit_by_bit Apr 07 '15 at 11:50
  • You always receive the image basic version then if you want to see the real version its get downloaded, the small version comes into base64 string as small as 2kb payload with massage info. – Retro Apr 07 '15 at 11:56
  • http://stackoverflow.com/questions/11402329/base64-encoded-image-size says the file size may increase with Base 64. Besides, do you intend to say that the client should initiate 2 upload requests when one image/video is to be shared? – bit_by_bit Apr 07 '15 at 13:10
  • Most systems make the thumbnail on the server to prevent wacky clients creating bogus images as clickbait or otherwise polluting the space. As for upload/download requests, most of this occurs with a session component and a separate content-provision component, so its usually two channels anyway (even if its to the same server). As for space on the server, a 2~3kb thumbnail in base64 really isn't a big deal in an environment where you are encouraging users to generate reams and reams of text content already and the original image may be anywhere from 1 to 100MB. – zxq9 Apr 07 '15 at 14:01
  • Don't you think the malicious formation of thumbnails or even spamming gets restricted in terms of an executable (apk). The executable would have one and only one logic to process and render a thumbnail. Your thoughts? – bit_by_bit Apr 07 '15 at 14:29
  • 1
    No. You simply cannot trust anything from the client side, ever. Any program that speaks your protocol can masquerade as a part of your system. This is why you cannot just trust the client side to do the right thing unless screwy data will have zero impact on the service as a whole (as in, all the impact will hit only the origin of that data and nowhere else). – zxq9 Apr 07 '15 at 22:16

1 Answers1

0

you need to upload your original files on your server(web server) and using web server you can send thumbnail of file base64 to ejabberd server. create blurred image from client side not server side(less work load on server if you do it client side).In this case you need to create custom ejabberd module via this custom module http server communicate from ejabberd server.

Sunil Singh
  • 538
  • 3
  • 12