Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Full disclosure upfront, I'm a developer at <a href="http://www.thumbnailapp.com" rel="nofollow">ThumbnailApp.com</a>.</p> <p>It's an JSON API service with an optional Javascript SDK which I think does exactly what you're after: It will parse a string to detect any urls and return the title, description and thumbnail of the asset. If the page has OpenGraph tags, it will use those for the image thumbnail. It's currently in private beta but we're adding more accounts each week.</p> <p>If you feel that you really need a do-it-yourself solution: </p> <p>Checkout the python based <a href="https://github.com/adamn/python-webkit2png" rel="nofollow">Webkit2Png</a> and the headless browser <a href="http://phantomjs.org/" rel="nofollow">PhantomJs</a>. They can render webpages to an image (default size is 800x600), then you'll have to write some code to resize and crop the image like taswyn mentioned. Ideally you would then upload the resized image to Amazon S3 and then get it hosted on a CDN such as CloudFront.</p> <p>To get the title and description, first get the URL content (cURL or whatever) and you will need to check the <code>content-type</code> header to make sure it's a webpage. If it is, you can then use a HTML parser such as the <a href="http://simplehtmldom.sourceforge.net/" rel="nofollow">SimpleHTMLDOM</a> PHP library to grab the title and description meta data. If you want it exactly like Facebook you will also need to check for any OpenGraph tags specifically the <code>og:image</code> tag.</p> <p>Also don't forget about caching. The first render and description parsing can take a long time. Even if your site is fast, the webpage you're rendering could be slow and the best approach is to render / parse it once, then just save and return the resized image and meta data for subsequent requests. Depending on what your requirements are you may need to refresh the cached data every hour or you could get away with refreshing it once a day.</p> <p>To do it yourself takes quite a bit of work and lots of server configuration. I feel using a 3rd party service is a better way to go, but obviously I have a biased opinion :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload