Ticket #40439: 40439.5.diff
File 40439.5.diff, 2.7 KB (added by , 5 years ago) |
---|
-
src/wp-admin/includes/image.php
277 277 278 278 wp_update_attachment_metadata( $attachment_id, $image_meta ); 279 279 } else { 280 // TODO: handleerrors.280 // TODO: log errors. 281 281 } 282 282 } else { 283 // TODO: handleerrors.283 // TODO: log errors. 284 284 } 285 285 } elseif ( ! empty( $exif_meta['orientation'] ) && (int) $exif_meta['orientation'] !== 1 ) { 286 286 // Rotate the whole original image if there is EXIF data and "orientation" is not 1. … … 309 309 310 310 wp_update_attachment_metadata( $attachment_id, $image_meta ); 311 311 } else { 312 // TODO: handleerrors.312 // TODO: log errors. 313 313 } 314 314 } 315 315 } … … 396 396 $rotated = $editor->maybe_exif_rotate(); 397 397 398 398 if ( is_wp_error( $rotated ) ) { 399 // TODO: handleerrors.399 // TODO: log errors. 400 400 } 401 401 } 402 402 … … 405 405 $new_size_meta = $editor->make_subsize( $new_size_data ); 406 406 407 407 if ( is_wp_error( $new_size_meta ) ) { 408 $error_code = $new_size_meta->get_error_code(); 409 410 if ( $error_code === 'error_getting_dimensions' ) { 411 // Ignore errors when `image_resize_dimensions()` returns false. 412 // They mean that the requested size is larger than the original image and should be skipped. 413 continue; 414 } 415 416 if ( empty( $image_meta['subsize_errors'] ) ) { 417 $image_meta['subsize_errors'] = array(); 418 } 419 420 $error = array( 421 'error_code' => $error_code, 422 'error_message' => $new_size_meta->get_error_message(), 423 ); 424 425 // Store the error code and error message for displaying in the UI. 426 $image_meta['subsize_errors'][ $new_size_name ] = $error; 408 // TODO: log errors. 427 409 } else { 428 // The sub-size was created successfully.429 // Clear out previous errors in creating this subsize.430 if ( ! empty( $image_meta['subsize_errors'][ $new_size_name ] ) ) {431 unset( $image_meta['subsize_errors'][ $new_size_name ] );432 }433 434 if ( empty( $image_meta['subsize_errors'] ) ) {435 unset( $image_meta['subsize_errors'] );436 }437 438 410 // Save the size meta value. 439 411 $image_meta['sizes'][ $new_size_name ] = $new_size_meta; 412 wp_update_attachment_metadata( $attachment_id, $image_meta ); 440 413 } 441 442 wp_update_attachment_metadata( $attachment_id, $image_meta );443 414 } 444 415 } else { 445 416 // Fall back to `$editor->multi_resize()`. … … 447 418 448 419 if ( ! empty( $created_sizes ) ) { 449 420 $image_meta['sizes'] = array_merge( $image_meta['sizes'], $created_sizes ); 450 unset( $image_meta['subsize_errors'] );451 421 wp_update_attachment_metadata( $attachment_id, $image_meta ); 452 422 } 453 423 }