wphooks.info - intermediate_image_sizes_advanced

intermediate_image_sizes_advanced

(trunk - 5.0-alpha-42719)

The hook occurs in the following file:

wp-admin/includes/image.php:
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
		 * Filters the image sizes automatically generated when uploading an image.
		 *
		 * @since 2.9.0
		 * @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 $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, $attachment_id );

		if ( $sizes ) {
			$editor = wp_get_image_editor( $file );

			if ( ! is_wp_error( $editor ) ) {
				$metadata['sizes'] = $editor->multi_resize( $sizes );
			}
		} else {
			$metadata['sizes'] = array();