X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0f684a09c03e547d3132bddc970cbeafcd1102f4..caeaf8dc94b5e3f75dc98ec92dc7b76049cdddb6:/wp-includes/media-template.php diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php index 25354618..758c7f5c 100644 --- a/wp-includes/media-template.php +++ b/wp-includes/media-template.php @@ -50,7 +50,8 @@ function wp_underscore_audio_template() { function wp_underscore_video_template() { $video_types = wp_get_video_extensions(); ?> -<# var w, h, settings = wp.media.view.settings, +<# var w_rule = h_rule = '', + w, h, settings = wp.media.view.settings, isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/); if ( settings.contentWidth && data.model.width >= settings.contentWidth ) { @@ -60,16 +61,23 @@ function wp_underscore_video_template() { } if ( w !== data.model.width ) { - h = Math.ceil( ( h * w ) / data.model.width ); + h = Math.ceil( ( data.model.height * w ) / data.model.width ); } else { h = data.model.height; } + + if ( w ) { + w_rule = 'width: ' + w + 'px; '; + } + if ( h ) { + h_rule = 'height: ' + h + 'px;'; + } #> -
+