mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
Introduce maybe_regenerate_attachment_metadata( $attachment ). On the Edit Media screen, call it for Audio and Video files.
The functions checks if the item is lacking metadata altogether. If a video or audio file was uploaded prior to 3.6, it does not have any metadata. This tries to fix it. Implements locking via a transient to protect against this running in parallel with another request. This is the minimum viable product for #26825, but leaving the ticket open unless this function needs to be called in other places. See #26825. git-svn-id: https://develop.svn.wordpress.org/trunk@27127 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2636,10 +2636,14 @@ function edit_form_image_editor( $post ) {
|
||||
<?php
|
||||
elseif ( $attachment_id && 0 === strpos( $post->post_mime_type, 'audio/' ) ):
|
||||
|
||||
maybe_regenerate_attachment_metadata( $post );
|
||||
|
||||
echo wp_audio_shortcode( array( 'src' => $att_url ) );
|
||||
|
||||
elseif ( $attachment_id && 0 === strpos( $post->post_mime_type, 'video/' ) ):
|
||||
|
||||
maybe_regenerate_attachment_metadata( $post );
|
||||
|
||||
$meta = wp_get_attachment_metadata( $attachment_id );
|
||||
$w = ! empty( $meta['width'] ) ? min( $meta['width'], 600 ) : 0;
|
||||
$h = 0;
|
||||
|
||||
Reference in New Issue
Block a user