Instagram Embed Plugin - is it possible?

@codinghorror thanks for the insight! After doing a search for “variable height” here on the forum, I’m surprised I did not come across that important info already.

From the API docs, this is the response:

{
    "author_id": 9538472,
    "author_name": "diegoquinteiro",
    "author_url": "http://instagram.com/diegoquinteiro",
    "height": null,
    "html":"...",
    "media_id": "558717847597368461_9538472",
    "provider_name": "Instagram",
    "provider_url": "http://instagram.com/",
    "title": "Wii Gato (Lipe Sleep)",
    "type": "rich",
    "thumbnail_url": "http://distilleryimage5.ak.instagram.com/5dceebb02c5811e3b57222000a9e07e9_8.jpg",
    "thumbnail_width": 640,
    "thumbnail_height": 640,
    "version": "1.0",
    "width": 658
}

Here are the request parameters:

PARAMETERS

URL A short link, like http://instagr.am/p/fA9uwTtkSN/.
MAXWIDTH Maximum width of returned media. This value is optional and must be greater than 320. Note that the maxheight parameter is not supported and always returns null. This is because the embed code is responsive and its height varies depending on its width and lenght of the caption.
HIDECAPTION If set to true, the embed code hides the caption. Defaults to false.
OMITSCRIPT If set to true, the embed code does not include the script tag. This is useful for websites that want to handle the loading of the embeds.js script by themselves. To manually initialize the embed code, call the JS function instgrm.Embeds.process().
CALLBACK A JSON callback to be invoked.
https://www.instagram.com/developer/embedding/#oembed

While the oembed GET request doesn’t give you the height, there is a link that can be visited that gives you a direct link to the image file.

Medium Example:
https://instagram.com/p/Bi44Jb6Da4n/media/?size=m

Large Example:
https://instagram.com/p/Bi44Jb6Da4n/media/?size=l

The dimensions from the medium link could be used to get the image’s proportions and then I could combine that with the width from oEmbed request response to get the height.

I’m assuming the “variable height” problem applies to the entire embed box though, not just the image/video, correct? If so, then the caption might introduce issues too.