facebook/wordpress — pull request #492 by niallkennedy (2013-09-14 20:32:24+00:00)
Title: convert Instagram WP_Embeds in post content to an og:image

* Find Instagram media URIs on its own line in post content similar to `WP_Embed->autoembed()` discovery.
* Construct an [Instagram media redirect URI](http://instagram.com/developer/embedding/#media_redirect) from the Instagram media ID. This URI will 302 redirect to a large Instagram image (if the Instagram media ID still exists).

The full image URI and dimensions are available via the [Instagram OEmbed endpoint](http://instagram.com/developer/embedding/#oembed) but would require an additional HTTP request and caching, possibly integrated with the autoembed handlers run during `the_content`. Capturing the quick win of the media redirect for now.

An Instagram video page has the same URI structure as an Instagram image page. A media ID corresponding to an Instagram video will return an image when requested via the media redirect endpoint.

Open Graph image values are an array with priority given to ordering of the list of images. This diff considers `WP_Embed` images a lower priority than attached images but a higher priority than gallery content.