6

I am making a chat application and recently observed apps like WhatsApp,Viber,Skype when sent any link , the chat bubble changes from he text link to preview image with link as attached.

Can anyone tell me how to achieve it in IOS.

enter image description here

codelover
  • 1,113
  • 10
  • 28

1 Answers1

0

If your application has a server side api, this problem could be solved with server side making a preview thumbnail with a lower quality that would be sent to your client app, you would still need to manually keep track of what files you have stored this is where SDWebImage might come in handy (url: http://cocoadocs.org/docsets/SDWebImage/3.7.5/).

The problem is, there is no way to preview an image without actually downloading the data itself, so that's why my bet would be on the server side of that solution.

user2695712
  • 193
  • 1
  • 9
  • Well not close but good direction , what I am looking is like shat apps or FB if you want to post any URL it after few milliseconds fetched the thumbnail and displays beside it, how can this be done? – codelover Feb 24 '16 at 08:25
  • Well, my guess would be that the server takes a snapshot and passes it to the client via socket connection. Similar process as I described previously only optimized. You would need sockets because of that delay time. You could capture a screenshot from a hidden UIWebView and show it locally, but like I said before - it would require you to download the data before display, there is just no way around that as far as I know. – user2695712 Feb 24 '16 at 08:39
  • No I don't need screen shot, okay if you have Skype try entering the link https://github.com/jivesoftware/PDTSimpleCalendar in the input text box. Wait for a while and see the bubble changes from link to image preview of its image inside its page, may be metadata image or title area icon. Thats what i want – codelover Feb 24 '16 at 10:40
  • There is no image in the metadata, it has nothing to do with the preview of the website. Either there could be one somewhere created previously and you get the url to that file, or you make your own. It's not something that gets created automatically. you could try and you some third party service like https://www.shrinktheweb.com/ but that's about it. – user2695712 Feb 25 '16 at 08:36
  • how is skype, whatsapp doing for the inapp preview for teh chat when you enter the link then. – codelover Jun 01 '17 at 10:00