Changeset 46507
- Timestamp:
- 10/14/2019 08:03:01 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/image.php
r46459 r46507 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 ) { … … 310 310 wp_update_attachment_metadata( $attachment_id, $image_meta ); 311 311 } else { 312 // TODO: handleerrors.312 // TODO: log errors. 313 313 } 314 314 } … … 397 397 398 398 if ( is_wp_error( $rotated ) ) { 399 // TODO: handleerrors.399 // TODO: log errors. 400 400 } 401 401 } … … 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; 440 } 441 442 wp_update_attachment_metadata( $attachment_id, $image_meta ); 412 wp_update_attachment_metadata( $attachment_id, $image_meta ); 413 } 443 414 } 444 415 } else { … … 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 }
Note: See TracChangeset
for help on using the changeset viewer.