| 29 | | $meta = wp_get_attachment_metadata( $thumbnail_id ); |
| 30 | | if ( ! empty( $meta['sizes'] ) ) { |
| 31 | | foreach ( $meta['sizes'] as $size => $data ) { |
| 32 | | if ( $data['width'] / $data['height'] > $aspect_ratio ) { |
| 33 | | $aspect_ratio = $data['width'] / $data['height']; |
| 34 | | $measurements = array( $data['width'], $data['height'] ); |
| 35 | | $image_size = $size; |
| | 31 | $meta = wp_get_attachment_metadata( $thumbnail_id ); |
| | 32 | if ( ! empty( $meta['sizes'] ) ) { |
| | 33 | foreach ( $meta['sizes'] as $size => $data ) { |
| | 34 | if ( $data['width'] / $data['height'] > $aspect_ratio ) { |
| | 35 | $aspect_ratio = $data['width'] / $data['height']; |
| | 36 | $measurements = array( $data['width'], $data['height'] ); |
| | 37 | $image_size = $size; |
| | 38 | } |
| 40 | | /** |
| 41 | | * Filters the thumbnail image size for use in the embed template. |
| 42 | | * |
| 43 | | * @since 4.4.0 |
| 44 | | * @since 4.5.0 Added `$thumbnail_id` parameter. |
| 45 | | * |
| 46 | | * @param string $image_size Thumbnail image size. |
| 47 | | * @param int $thumbnail_id Attachment ID. |
| 48 | | */ |
| 49 | | $image_size = apply_filters( 'embed_thumbnail_image_size', $image_size, $thumbnail_id ); |
| | 42 | /** |
| | 43 | * Filters the thumbnail image size for use in the embed template. |
| | 44 | * |
| | 45 | * @since 4.4.0 |
| | 46 | * @since 4.5.0 Added `$thumbnail_id` parameter. |
| | 47 | * |
| | 48 | * @param string $image_size Thumbnail image size. |
| | 49 | * @param int $thumbnail_id Attachment ID. |
| | 50 | */ |
| | 51 | $image_size = apply_filters( 'embed_thumbnail_image_size', $image_size, $thumbnail_id ); |
| 53 | | /** |
| 54 | | * Filters the thumbnail shape for use in the embed template. |
| 55 | | * |
| 56 | | * Rectangular images are shown above the title while square images |
| 57 | | * are shown next to the content. |
| 58 | | * |
| 59 | | * @since 4.4.0 |
| 60 | | * @since 4.5.0 Added `$thumbnail_id` parameter. |
| 61 | | * |
| 62 | | * @param string $shape Thumbnail image shape. Either 'rectangular' or 'square'. |
| 63 | | * @param int $thumbnail_id Attachment ID. |
| 64 | | */ |
| 65 | | $shape = apply_filters( 'embed_thumbnail_image_shape', $shape, $thumbnail_id ); |
| | 55 | /** |
| | 56 | * Filters the thumbnail shape for use in the embed template. |
| | 57 | * |
| | 58 | * Rectangular images are shown above the title while square images |
| | 59 | * are shown next to the content. |
| | 60 | * |
| | 61 | * @since 4.4.0 |
| | 62 | * @since 4.5.0 Added `$thumbnail_id` parameter. |
| | 63 | * |
| | 64 | * @param string $shape Thumbnail image shape. Either 'rectangular' or 'square'. |
| | 65 | * @param int $thumbnail_id Attachment ID. |
| | 66 | */ |
| | 67 | $shape = apply_filters( 'embed_thumbnail_image_shape', $shape, $thumbnail_id ); |
| | 68 | } |