@@ 584-613 (lines=30) @@ | ||
581 | 'thumbnails' => array() |
|
582 | ); |
|
583 | ||
584 | if ( in_array( $ext, array( 'jpg', 'jpeg', 'png', 'gif' ) ) ) { |
|
585 | $metadata = wp_get_attachment_metadata( $media_item->ID ); |
|
586 | if ( isset( $metadata['height'], $metadata['width'] ) ) { |
|
587 | $response['height'] = $metadata['height']; |
|
588 | $response['width'] = $metadata['width']; |
|
589 | } |
|
590 | ||
591 | if ( isset( $metadata['sizes'] ) ) { |
|
592 | /** |
|
593 | * Filter the thumbnail sizes available for each attachment ID. |
|
594 | * |
|
595 | * @module json-api |
|
596 | * |
|
597 | * @since 3.9.0 |
|
598 | * |
|
599 | * @param array $metadata['sizes'] Array of thumbnail sizes available for a given attachment ID. |
|
600 | * @param string $media_id Attachment ID. |
|
601 | */ |
|
602 | $sizes = apply_filters( 'rest_api_thumbnail_sizes', $metadata['sizes'], $media_id ); |
|
603 | if ( is_array( $sizes ) ) { |
|
604 | foreach ( $sizes as $size => $size_details ) { |
|
605 | $response['thumbnails'][ $size ] = dirname( $response['URL'] ) . '/' . $size_details['file']; |
|
606 | } |
|
607 | } |
|
608 | } |
|
609 | ||
610 | if ( isset( $metadata['image_meta'] ) ) { |
|
611 | $response['exif'] = $metadata['image_meta']; |
|
612 | } |
|
613 | } |
|
614 | ||
615 | if ( in_array( $ext, array( 'mp3', 'm4a', 'wav', 'ogg' ) ) ) { |
|
616 | $metadata = wp_get_attachment_metadata( $media_item->ID ); |
@@ 1212-1241 (lines=30) @@ | ||
1209 | 'thumbnails' => array() |
|
1210 | ); |
|
1211 | ||
1212 | if ( in_array( $ext, array( 'jpg', 'jpeg', 'png', 'gif' ) ) ) { |
|
1213 | $metadata = wp_get_attachment_metadata( $media_item->ID ); |
|
1214 | if ( isset( $metadata['height'], $metadata['width'] ) ) { |
|
1215 | $response['height'] = $metadata['height']; |
|
1216 | $response['width'] = $metadata['width']; |
|
1217 | } |
|
1218 | ||
1219 | if ( isset( $metadata['sizes'] ) ) { |
|
1220 | /** |
|
1221 | * Filter the thumbnail sizes available for each attachment ID. |
|
1222 | * |
|
1223 | * @module json-api |
|
1224 | * |
|
1225 | * @since 3.9.0 |
|
1226 | * |
|
1227 | * @param array $metadata['sizes'] Array of thumbnail sizes available for a given attachment ID. |
|
1228 | * @param string $media_id Attachment ID. |
|
1229 | */ |
|
1230 | $sizes = apply_filters( 'rest_api_thumbnail_sizes', $metadata['sizes'], $media_id ); |
|
1231 | if ( is_array( $sizes ) ) { |
|
1232 | foreach ( $sizes as $size => $size_details ) { |
|
1233 | $response['thumbnails'][ $size ] = dirname( $response['URL'] ) . '/' . $size_details['file']; |
|
1234 | } |
|
1235 | } |
|
1236 | } |
|
1237 | ||
1238 | if ( isset( $metadata['image_meta'] ) ) { |
|
1239 | $response['exif'] = $metadata['image_meta']; |
|
1240 | } |
|
1241 | } |
|
1242 | ||
1243 | if ( in_array( $ext, array( 'mp3', 'm4a', 'wav', 'ogg' ) ) ) { |
|
1244 | $metadata = wp_get_attachment_metadata( $media_item->ID ); |