Changeset 27328
- Timestamp:
- 02/28/2014 09:27:40 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
-
wp-admin/css/media.css (modified) (1 diff)
-
wp-admin/includes/media.php (modified) (1 diff)
-
wp-includes/media.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/media.css
r27289 r27328 641 641 } 642 642 643 audio, video { 644 display: inline-block; 645 max-width: 100%; 646 } 647 648 .mejs-container { 649 width: 100%; 650 } 651 643 652 /* =Media Queries 644 653 -------------------------------------------------------------- */ -
trunk/src/wp-admin/includes/media.php
r27316 r27328 2641 2641 2642 2642 $meta = wp_get_attachment_metadata( $attachment_id ); 2643 $w = ! empty( $meta['width'] ) ? min( $meta['width'], 600 ) : 0; 2644 $h = 0; 2645 if ( ! empty( $meta['height'] ) ) 2646 $h = $meta['height']; 2647 if ( $h && $w < $meta['width'] ) 2643 $w = ! empty( $meta['width'] ) ? min( $meta['width'], 640 ) : 0; 2644 $h = ! empty( $meta['height'] ) ? $meta['height'] : 0; 2645 if ( $h && $w < $meta['width'] ) { 2648 2646 $h = round( ( $meta['height'] * $w ) / $meta['width'] ); 2647 } 2649 2648 2650 2649 $attr = array( 'src' => $att_url ); 2651 2652 if ( ! empty( $meta['width' ] ) ) 2650 if ( ! empty( $w ) && ! empty( $h ) ) { 2653 2651 $attr['width'] = $w; 2654 2655 if ( ! empty( $meta['height'] ) )2656 2652 $attr['height'] = $h; 2653 } 2657 2654 2658 2655 echo wp_video_shortcode( $attr ); -
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.