Make WordPress Core

Changeset 23768


Ignore:
Timestamp:
03/21/2013 05:17:25 AM (12 years ago)
Author:
markjaquith
Message:

Show a playable audio/video preview on the Edit Attachment screen.

props wonderboymusic. fixes #23726

File:
1 edited

Legend:

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

    r23766 r23768  
    22862286    $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
    22872287
    2288     $att_url = wp_get_attachment_url( $post->ID );
    2289 
     2288    $att_url = wp_get_attachment_url( $post->ID ); ?>
     2289    <div class="wp_attachment_holder">
     2290    <?php
    22902291    if ( wp_attachment_is_image( $post->ID ) ) :
    22912292        $image_edit_button = '';
     
    22952296        }
    22962297    ?>
    2297     <div class="wp_attachment_holder">
     2298
    22982299        <div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
    22992300
     
    23052306            <?php if ( $open ) wp_image_editor( $attachment_id ); ?>
    23062307        </div>
     2308    <?php
     2309    elseif ( $attachment_id && 0 === strpos( $post->post_mime_type, 'audio/' ) ):
     2310
     2311        echo do_shortcode( '[audio src="' . $att_url . '"]' );
     2312
     2313    elseif ( $attachment_id && 0 === strpos( $post->post_mime_type, 'video/' ) ):
     2314
     2315        $meta = wp_get_attachment_metadata( $attachment_id );
     2316        $shortcode = sprintf( '[video src="%s"%s%s]',
     2317            $att_url,
     2318            empty( $meta['width'] ) ? '' : sprintf( ' width="%d"', $meta['width'] ),
     2319            empty( $meta['height'] ) ? '' : sprintf( ' height="%d"', $meta['height'] )
     2320        );
     2321        echo do_shortcode( $shortcode );
     2322
     2323    endif; ?>
    23072324    </div>
    2308     <?php endif; ?>
    2309 
    23102325    <div class="wp_attachment_details edit-form-section">
    23112326        <p>
Note: See TracChangeset for help on using the changeset viewer.