@@ 1249-1286 (lines=38) @@ | ||
1246 | $response['exif'] = $metadata; |
|
1247 | } |
|
1248 | ||
1249 | if ( |
|
1250 | in_array( $ext, array( 'ogv', 'mp4', 'mov', 'wmv', 'avi', 'mpg', '3gp', '3g2', 'm4v' ) ) |
|
1251 | || |
|
1252 | $response['mime_type'] === 'video/videopress' |
|
1253 | ) { |
|
1254 | $metadata = wp_get_attachment_metadata( $media_item->ID ); |
|
1255 | if ( isset( $metadata['height'], $metadata['width'] ) ) { |
|
1256 | $response['height'] = $metadata['height']; |
|
1257 | $response['width'] = $metadata['width']; |
|
1258 | } |
|
1259 | ||
1260 | if ( isset( $metadata['length'] ) ) { |
|
1261 | $response['length'] = $metadata['length']; |
|
1262 | } |
|
1263 | ||
1264 | // add VideoPress info |
|
1265 | if ( function_exists( 'video_get_info_by_blogpostid' ) ) { |
|
1266 | $info = video_get_info_by_blogpostid( $this->api->get_blog_id_for_output(), $media_id ); |
|
1267 | ||
1268 | // Thumbnails |
|
1269 | if ( function_exists( 'video_format_done' ) && function_exists( 'video_image_url_by_guid' ) ) { |
|
1270 | $response['thumbnails'] = array( 'fmt_hd' => '', 'fmt_dvd' => '', 'fmt_std' => '' ); |
|
1271 | foreach ( $response['thumbnails'] as $size => $thumbnail_url ) { |
|
1272 | if ( video_format_done( $info, $size ) ) { |
|
1273 | $response['thumbnails'][ $size ] = video_image_url_by_guid( $info->guid, $size ); |
|
1274 | } else { |
|
1275 | unset( $response['thumbnails'][ $size ] ); |
|
1276 | } |
|
1277 | } |
|
1278 | } |
|
1279 | ||
1280 | $response['videopress_guid'] = $info->guid; |
|
1281 | $response['videopress_processing_done'] = true; |
|
1282 | if ( '0000-00-00 00:00:00' == $info->finish_date_gmt ) { |
|
1283 | $response['videopress_processing_done'] = false; |
|
1284 | } |
|
1285 | } |
|
1286 | } |
|
1287 | ||
1288 | $response['thumbnails'] = (object) $response['thumbnails']; |
|
1289 |
@@ 621-654 (lines=34) @@ | ||
618 | $response['exif'] = $metadata; |
|
619 | } |
|
620 | ||
621 | if ( in_array( $ext, array( 'ogv', 'mp4', 'mov', 'wmv', 'avi', 'mpg', '3gp', '3g2', 'm4v' ) ) ) { |
|
622 | $metadata = wp_get_attachment_metadata( $media_item->ID ); |
|
623 | if ( isset( $metadata['height'], $metadata['width'] ) ) { |
|
624 | $response['height'] = $metadata['height']; |
|
625 | $response['width'] = $metadata['width']; |
|
626 | } |
|
627 | ||
628 | if ( isset( $metadata['length'] ) ) { |
|
629 | $response['length'] = $metadata['length']; |
|
630 | } |
|
631 | ||
632 | // add VideoPress info |
|
633 | if ( function_exists( 'video_get_info_by_blogpostid' ) ) { |
|
634 | $info = video_get_info_by_blogpostid( $this->site->get_id(), $media_id ); |
|
635 | ||
636 | // Thumbnails |
|
637 | if ( function_exists( 'video_format_done' ) && function_exists( 'video_image_url_by_guid' ) ) { |
|
638 | $response['thumbnails'] = array( 'fmt_hd' => '', 'fmt_dvd' => '', 'fmt_std' => '' ); |
|
639 | foreach ( $response['thumbnails'] as $size => $thumbnail_url ) { |
|
640 | if ( video_format_done( $info, $size ) ) { |
|
641 | $response['thumbnails'][ $size ] = video_image_url_by_guid( $info->guid, $size ); |
|
642 | } else { |
|
643 | unset( $response['thumbnails'][ $size ] ); |
|
644 | } |
|
645 | } |
|
646 | } |
|
647 | ||
648 | $response['videopress_guid'] = $info->guid; |
|
649 | $response['videopress_processing_done'] = true; |
|
650 | if ( '0000-00-00 00:00:00' == $info->finish_date_gmt ) { |
|
651 | $response['videopress_processing_done'] = false; |
|
652 | } |
|
653 | } |
|
654 | } |
|
655 | ||
656 | $response['thumbnails'] = (object) $response['thumbnails']; |
|
657 |