[wp-trac] [WordPress Trac] #56217: Add video rotation info in wp_read_video_metadata()
WordPress Trac
noreply at wordpress.org
Thu Jul 14 09:03:13 UTC 2022
#56217: Add video rotation info in wp_read_video_metadata()
---------------------------+------------------------------
Reporter: opajaap | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 6.0
Severity: normal | Resolution:
Keywords: needs-testing | Focuses:
---------------------------+------------------------------
Comment (by opajaap):
I need this addition for my plugin wp-photo-album-plus
I made a copy of wp_read_video_metadata(), named it
wppa_read_video_metadata() and added the proposed addition.
If you use the the current release candidate of my plugin (without the
addition):
https://downloads.wordpress.org/plugin/wp-photo-album-plus.8.2.03.006.zip
You get the wrong sizes,
when you use the dev version (with the addition):
https://downloads.wordpress.org/plugin/wp-photo-album-plus.8.2.04.001.zip
You get the right sizes, because of this piece of code in my function
wppa_fix_video_metadata():
{{{
$mp4info = wppa_read_video_metadata( $file );
// Make sure its a video
if ( $mp4info['fileformat'] != 'mp4' ) {
wppa_log( 'dbg', 'No mp4 fileformat in ' . $file . ' ' .
$where );
return false;
}
// Find sizes
$videox = isset( $mp4info['width'] ) ? $mp4info['width'] : '0';
$videoy = isset( $mp4info['height'] ) ? $mp4info['height'] : '0';
// Rotated?
if ( isset( $mp4info['rotate'] ) ) {
$rot = $mp4info['rotate'];
if ( $rot == 90 || $rot == 270 ) {
$t = $videox;
$videox = $videoy;
$videoy = $t;
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56217#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list