Changeset 27328 for trunk/src/wp-includes/media.php
- Timestamp:
- 02/28/2014 09:27:40 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r27320 r27328 1059 1059 1060 1060 $outer = 22; // default padding and border of wrapper 1061 1062 $default_width = 640; 1063 $default_height = 360; 1064 1061 1065 $theme_width = $content_width - $outer; 1066 $theme_height = round( ( $default_height * $theme_width ) / $default_width ); 1067 1062 1068 $data = compact( 'type', 'style' ); 1063 1069 … … 1091 1097 1092 1098 if ( 'video' === $type ) { 1093 $width = empty( $meta['width'] ) ? 640 : $meta['width']; 1094 $height = empty( $meta['height'] ) ? 360 : $meta['height']; 1095 $theme_height = round( ( $height * $theme_width ) / $width ); 1099 if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) { 1100 $width = $meta['width']; 1101 $height = $meta['height']; 1102 $theme_height = round( ( $height * $theme_width ) / $width ); 1103 } else { 1104 $width = $default_width; 1105 $height = $default_height; 1106 } 1107 1096 1108 $track['dimensions'] = array( 1097 1109 'original' => compact( 'width', 'height' ), … … 1166 1178 <div class="wp-playlist-current-item"></div> 1167 1179 <?php endif ?> 1168 <<?php echo $safe_type ?> controls="controls" preload="metadata" width="<?php echo (int) $theme_width ?>"></<?php echo $safe_type ?>> 1180 <<?php echo $safe_type ?> controls="controls" preload="metadata" width="<?php 1181 echo (int) $theme_width; 1182 ?>"<?php if ( 'video' === $safe_type ): 1183 echo ' height="', (int) $theme_height, '"'; 1184 endif; ?>></<?php echo $safe_type ?>> 1169 1185 <div class="wp-playlist-next"></div> 1170 1186 <div class="wp-playlist-prev"></div> … … 1445 1461 'autoplay' => '', 1446 1462 'preload' => 'metadata', 1463 'width' => 640, 1447 1464 'height' => 360, 1448 'width' => empty( $content_width ) ? 640 : $content_width,1449 1465 ); 1450 1466 … … 1455 1471 extract( $atts ); 1456 1472 1457 $w = $width; 1458 $h = $height; 1459 if ( is_admin() && $width > 600 ) 1460 $w = 600; 1461 elseif ( ! is_admin() && $w > $defaults_atts['width'] ) 1462 $w = $defaults_atts['width']; 1463 1464 if ( $w < $width ) 1465 $height = round( ( $h * $w ) / $width ); 1466 1467 $width = $w; 1473 if ( is_admin() ) { 1474 // shrink the video so it isn't huge in the admin 1475 if ( $width > $defaults_atts['width'] ) { 1476 $height = round( ( $height * $defaults_atts['width'] ) / $width ); 1477 $width = $defaults_atts['width']; 1478 } 1479 } else { 1480 // if the video is bigger than the theme 1481 if ( $width > $content_width ) { 1482 $height = round( ( $height * $content_width ) / $width ); 1483 $width = $content_width; 1484 } 1485 } 1468 1486 1469 1487 $yt_pattern = '#^https?://(:?www\.)?(:?youtube\.com/watch|youtu\.be/)#'; … … 1546 1564 } else { 1547 1565 $type = wp_check_filetype( $$fallback, wp_get_mime_types() ); 1548 // m4v sometimes shows up as video/mpeg which collides with mp41549 if ( 'm4v' === $type['ext'] )1550 $type['type'] = 'video/m4v';1551 1566 } 1552 1567 $html .= sprintf( $source, $type['type'], esc_url( $$fallback ) );
Note: See TracChangeset
for help on using the changeset viewer.