Filter hook 'wp_generate_attachment_metadata'

in WP Core File wp-admin/includes/image.php at line 185

Description

If any of the currently registered image sub-sizes are missing, create them and update the image meta data. if both the image meta and the attached file are missing. / function wp_update_image_subsizes( $attachment_id ) { $image_meta = wp_get_attachment_metadata( $attachment_id ); $image_file = wp_get_original_image_path( $attachment_id ); if ( empty( $image_meta ) || ! is_array( $image_meta ) ) { /* Previously failed upload? If there is an uploaded file, make all sub-sizes and generate all of the attachment meta.

Occurrences

Filename Line Number
wp-admin/includes/image.php 185
wp-admin/includes/image.php 722

Parameters

Type Name Description
int $attachment_id The image attachment post ID.

PHP Doc

/**
 * If any of the currently registered image sub-sizes are missing,
 * create them and update the image meta data.
 *
 * @since 5.3.0
 *
 * @param int $attachment_id The image attachment post ID.
 * @return array|WP_Error The updated image meta data array or WP_Error object
 *                        if both the image meta and the attached file are missing.
 */
function wp_update_image_subsizes( $attachment_id ) {
	$image_meta = wp_get_attachment_metadata( $attachment_id );
	$image_file = wp_get_original_image_path( $attachment_id );

	if ( empty( $image_meta ) || ! is_array( $image_meta ) ) {
		/*
		 * Previously failed upload?
		 * If there is an uploaded file, make all sub-sizes and generate all of the attachment meta.
		 */