Plugin Directory


Opened 4 years ago

Closed 4 years ago

#2030 closed defect (invalid)

Shortcode Embeds: ted video size

Reported by: afercia Owned by: tmoorewp
Priority: normal Severity: normal
Plugin: jetpack Keywords: shortcodes ted
Cc: jeremy+wp@…


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,

Attachments (1)

ted-embed.png (392.1 KB) - added by afercia 4 years ago.

Download all attachments as: .zip

Change History (3)

@afercia4 years ago

comment:1 @jeherve4 years ago

  • 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

comment:2 @richardmtl4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Hi! I experienced the same thing as you while testing this. The video was there, even when I turned off Jetpack, and only when I used the Twenty Thirteen theme. However, after testing it more and looking at the code for Twenty Thirteen, there was no reason in the theme code for the video to be there. After even further testing, and changing the post format and re-saving, the video went away. I suspect that a transient value was making the video still load, and that the value was trashed after updating the post.

That being said, this is not a Jetpack bug, as the video was still there when Jetpack was off. This may be a Twenty Thirteen bug but I'm not sure about that. Since this isn't a Jetpack bug, I'm closing this as invalid.

Note: See TracTickets for help on using tickets.