| @@ 1247-1280 (lines=34) @@ | ||
| 1244 | $response['exif'] = $metadata; |
|
| 1245 | } |
|
| 1246 | ||
| 1247 | if ( in_array( $ext, array( 'ogv', 'mp4', 'mov', 'wmv', 'avi', 'mpg', '3gp', '3g2', 'm4v' ) ) ) { |
|
| 1248 | $metadata = wp_get_attachment_metadata( $media_item->ID ); |
|
| 1249 | if ( isset( $metadata['height'], $metadata['width'] ) ) { |
|
| 1250 | $response['height'] = $metadata['height']; |
|
| 1251 | $response['width'] = $metadata['width']; |
|
| 1252 | } |
|
| 1253 | ||
| 1254 | if ( isset( $metadata['length'] ) ) { |
|
| 1255 | $response['length'] = $metadata['length']; |
|
| 1256 | } |
|
| 1257 | ||
| 1258 | // add VideoPress info |
|
| 1259 | if ( function_exists( 'video_get_info_by_blogpostid' ) ) { |
|
| 1260 | $info = video_get_info_by_blogpostid( $this->api->get_blog_id_for_output(), $media_id ); |
|
| 1261 | ||
| 1262 | // Thumbnails |
|
| 1263 | if ( function_exists( 'video_format_done' ) && function_exists( 'video_image_url_by_guid' ) ) { |
|
| 1264 | $response['thumbnails'] = array( 'fmt_hd' => '', 'fmt_dvd' => '', 'fmt_std' => '' ); |
|
| 1265 | foreach ( $response['thumbnails'] as $size => $thumbnail_url ) { |
|
| 1266 | if ( video_format_done( $info, $size ) ) { |
|
| 1267 | $response['thumbnails'][ $size ] = video_image_url_by_guid( $info->guid, $size ); |
|
| 1268 | } else { |
|
| 1269 | unset( $response['thumbnails'][ $size ] ); |
|
| 1270 | } |
|
| 1271 | } |
|
| 1272 | } |
|
| 1273 | ||
| 1274 | $response['videopress_guid'] = $info->guid; |
|
| 1275 | $response['videopress_processing_done'] = true; |
|
| 1276 | if ( '0000-00-00 00:00:00' == $info->finish_date_gmt ) { |
|
| 1277 | $response['videopress_processing_done'] = false; |
|
| 1278 | } |
|
| 1279 | } |
|
| 1280 | } |
|
| 1281 | ||
| 1282 | $response['thumbnails'] = (object) $response['thumbnails']; |
|
| 1283 | ||
| @@ 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 | ||