Media: Pass the attachment ID to the intermediate_image_sizes_advanced filter.

Props drywallbmb, robbie505
Fixes 42745


git-svn-id: https://develop.svn.wordpress.org/trunk@42407 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2017-12-16 13:46:28 +00:00
parent 8f92dcf4a4
commit 186f963c34

View File

@ -130,11 +130,13 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
* *
* @since 2.9.0 * @since 2.9.0
* @since 4.4.0 Added the `$metadata` argument. * @since 4.4.0 Added the `$metadata` argument.
* @since 5.0.0 Added the `$attachment_id` argument.
* *
* @param array $sizes An associative array of image sizes. * @param array $sizes An associative array of image sizes.
* @param array $metadata An associative array of image metadata: width, height, file. * @param array $metadata An associative array of image metadata: width, height, file.
* @param int $attachment_id Current attachment ID.
*/ */
$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes, $metadata ); $sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes, $metadata, $attachment_id );
if ( $sizes ) { if ( $sizes ) {
$editor = wp_get_image_editor( $file ); $editor = wp_get_image_editor( $file );