Shortcode Embeds: ted video size
|Reported by:||afercia||Owned by:||tmoorewp|
trying to embed (using embed, not shortcode) a video from ted.com for example this one:
and struggled why I was getting an iframe with width 600px and height 900px. A vertical video :) See attached screenshot.
After a couple of hours of investigation... I tried to test also on twentythirteen and _s and...
iframe width 604 and height 906
iframe width 640 and height 960
realized the ratio was always 1.5 and noticed my theme has a $content_width = 600 so I checked $content_width on twentythirteen and _s and all this started to have some logic:
$content_width = 600
ted iframe width 600 and height 900
$content_width = 604
ted iframe width 604 and height 906
$content_width = 640
ted iframe width 640 and height 960
so seems ted.php doesn't set proper width/height and when an embed (or shortcode) doesn't have width/height set, the fallback size is given by wp_embed_defaults() in media.php which returns the smaller between 1.5 times the width, or 1000px
$height = min( ceil( $width * 1.5 ), 1000 );
the width is given by $content_width (if set) or set to 500
So it makes sense but besides the fact ted.php should properly set a size, is there any good reason why the default ratio of shortcodes and embeds should be 1.5? maybe twitter embeds or other embeds should be displayed someway "vertical" but videos should default to a more proper ratio, possibly 16:9 (0.5625).
And yes, there is some code in ted.php which tries to set a 16:9 ratio but seems it fails.
About wp_embed_defaults() will try to submit an idea for the core.
thx very much,
Change History (3)
- Cc jeremy+wp@… added
- Keywords shortcodes ted added; video embed ted.com removed
- Summary changed from ted video size to Shortcode Embeds: ted video size