Ticket #47872: 47872.3.diff
File 47872.3.diff, 1.8 KB (added by , 5 years ago) |
---|
-
src/wp-admin/includes/image.php
142 142 // Previously failed upload? 143 143 // If there is an uploaded file, make all sub-sizes and generate all of the attachment meta. 144 144 if ( ! empty( $image_file ) ) { 145 returnwp_create_image_subsizes( $image_file, $attachment_id );145 $image_meta = wp_create_image_subsizes( $image_file, $attachment_id ); 146 146 } else { 147 147 return new WP_Error( 'invalid_attachment', __( 'The attached file cannot be found.' ) ); 148 148 } 149 } 149 } else { 150 $missing_sizes = wp_get_missing_image_subsizes( $attachment_id ); 150 151 151 $missing_sizes = wp_get_missing_image_subsizes( $attachment_id ); 152 if ( empty( $missing_sizes ) ) { 153 return $image_meta; 154 } 152 155 153 if ( empty( $missing_sizes ) ) {154 return $image_meta;156 // This also updates the image meta. 157 $image_meta = _wp_make_subsizes( $missing_sizes, $image_file, $image_meta, $attachment_id ); 155 158 } 156 159 157 // This also updates the image meta. 158 return _wp_make_subsizes( $missing_sizes, $image_file, $image_meta, $attachment_id ); 160 /** 161 * Runs after new image sub-sizes have been created. 162 * 163 * At this point all of the new sub-sizes have been created successfully 164 * and the image metadata has been updated and saved. 165 * 166 * @since 5.3.0 167 * 168 * @param array $image_meta The image attachment metadata. 169 * @param int $attachment_id The attachment post ID. 170 * @param array $missing_sizes Array of the settings for the image sub-sizes that were created. 171 * @param string $image_file Path to the originally uploaded image file. 172 */ 173 do_action( 'wp_update_image_subsizes', $image_meta, $attachment_id, $missing_sizes, $image_file ); 174 175 return $image_meta; 159 176 } 160 177 161 178 /**