6

I'm creating an app to keep some URLs and I want to display a preview thumb beside of the title of the pages in a listview.

I saw something like this on Whatsapp, when I put a url (ex: http://www.google.com), that app gets some preview thumb and puts it beside the link.

So how can I do that and put this thumb in my listview?

Arvieira
  • 61
  • 2
  • 4

2 Answers2

0

Its best to use API's to generate thumb images from url... check this LINK... find free if u want...

example: from HERE

https://api.thumbalizr.com/?url=http://www.facebook.com

https://api.thumbalizr.com/?url=http://www.google.com
  • This link is very interesting. I've never saw it before, but I was looking for something little different from that. I already solved it. I' ll post here. – Arvieira Apr 05 '16 at 19:28
0

Looking for it for some hours, I found a solution that works, but I think that might be not the easiest way.

Solution: Download the url of the page to a temporary file on the device. Read the temporary file and try to find some regular expressions that describes the thumb of that page. Download the thumb with the link found before and delete the temporary file.

The patterns that I've look for are:

<meta property="og:image" content="http://link_for_the_thumb" />
<meta content="http://link_for_the_thumb" itemprop="image">
<link rel="image_src" href="http://link_for_the_thumb">

I think there is a better way much easier to do that, but that was the way that I found. Waiting for ideas.

Thank you

Arvieira
  • 61
  • 2
  • 4