Make WordPress Core


Ignore:
Timestamp:
04/14/2013 04:43:26 PM (12 years ago)
Author:
markjaquith
Message:

Constrain large videos from rendering bigger than $content_width on both frontend and backend.

props wonderboymusic. fixes #23955.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r23988 r23989  
    957957        'width' => empty( $content_width ) ? 640 : $content_width,
    958958    );
     959
    959960    foreach ( $default_types as $type  )
    960961        $defaults_atts[$type] = '';
     
    962963    $atts = shortcode_atts( $defaults_atts, $attr, 'video' );
    963964    extract( $atts );
     965
     966    $w = $width;
     967    $h = $height;
     968    if ( is_admin() && $width > 600 )
     969        $w = 600;
     970    elseif ( ! is_admin() && $w > $defaults_atts['width'] )
     971        $w = $defaults_atts['width'];
     972
     973    if ( $w < $width )
     974        $height = round( ( $h * $w ) / $width );
     975
     976    $width = $w;
    964977
    965978    $primary = false;
Note: See TracChangeset for help on using the changeset viewer.