Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

Instagram embeds should support non-standard (non-square) sizes #194

Open
goldenapples opened this issue Dec 9, 2016 · 0 comments
Open
Assignees

Comments

@goldenapples
Copy link
Contributor

Our shortcode for Instagram embeds has the crop ratio hard-coded to fit a square image. However, Instagram has supported non-square images for over a year now, and we should be able to support them.

Example of a landscape crop Instagram post:
https://www.instagram.com/p/BJcSHUTgAI0/?hl=en

Embed code:

<blockquote class="instagram-media" data-instgrm-version="7" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);"><div style="padding:8px;"> <div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:33.2407407407% 0; text-align:center; width:100%;"> <div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURczMzPf399fX1+bm5mzY9AMAAADiSURBVDjLvZXbEsMgCES5/P8/t9FuRVCRmU73JWlzosgSIIZURCjo/ad+EQJJB4Hv8BFt+IDpQoCx1wjOSBFhh2XssxEIYn3ulI/6MNReE07UIWJEv8UEOWDS88LY97kqyTliJKKtuYBbruAyVh5wOHiXmpi5we58Ek028czwyuQdLKPG1Bkb4NnM+VeAnfHqn1k4+GPT6uGQcvu2h2OVuIf/gWUFyy8OWEpdyZSa3aVCqpVoVvzZZ2VTnn2wU8qzVjDDetO90GSy9mVLqtgYSy231MxrY6I2gGqjrTY0L8fxCxfCBbhWrsYYAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px; position:relative; top:-22px; width:44px;"></div></div><p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;"><a href="https://www.instagram.com/p/BJcSHUTgAI0/" style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none;" target="_blank">A photo posted by 渡辺直美 (@watanabenaomi703)</a> on <time style=" font-family:Arial,sans-serif; font-size:14px; line-height:17px;" datetime="2016-08-23T06:55:49+00:00">Aug 22, 2016 at 11:55pm PDT</time></p></div></blockquote>
<script async defer src="//platform.instagram.com/en_US/embeds.js"></script>

This embed code reverses to [fusion-instagram url="https://www.instagram.com/p/BJcSHUTgAI0/"] , which renders like this:

screen_shot_2016-12-09_at_3 28 21_pm

I see that the image crop ratio is specified in the embed code markup by a padding value on the div wrapping the image: padding:33.2407407407% 0;. I think there should be a way to pull that value when reversing the embed code and convert it to a height parameter on the shortcode.

@goldenapples goldenapples self-assigned this Dec 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant