diff --git src/wp-admin/includes/image.php src/wp-admin/includes/image.php
index 1e265d45f7..41efa0ad13 100644
|
|
function wp_generate_attachment_metadata( $attachment_id, $file ) { |
581 | 581 | |
582 | 582 | // Resize based on the full size image, rather than the source. |
583 | 583 | if ( ! is_wp_error( $uploaded ) ) { |
584 | | $editor = wp_get_image_editor( $uploaded['path'] ); |
| 584 | $image_file = $uploaded['path']; |
585 | 585 | unset( $uploaded['path'] ); |
586 | 586 | |
587 | | if ( ! is_wp_error( $editor ) ) { |
588 | | $metadata['sizes'] = $editor->multi_resize( $merged_sizes ); |
589 | | $metadata['sizes']['full'] = $uploaded; |
590 | | } |
| 587 | $metadata['sizes'] = array( |
| 588 | 'full' => $uploaded, |
| 589 | ); |
| 590 | |
| 591 | // Save the meta data before any image post-processing errors could happen. |
| 592 | wp_update_attachment_metadata( $attachment_id, $metadata ); |
| 593 | |
| 594 | // Create sub-sizes saving the image meta after each. |
| 595 | $metadata = _wp_make_subsizes( $merged_sizes, $image_file, $metadata, $attachment_id ); |
591 | 596 | } |
592 | 597 | } |
593 | 598 | } |
diff --git tests/phpunit/tests/image/functions.php tests/phpunit/tests/image/functions.php
index 4d385ae2dc..8fa47c65a5 100644
|
|
class Tests_Image_Functions extends WP_UnitTestCase { |
435 | 435 | |
436 | 436 | $expected = array( |
437 | 437 | 'sizes' => array( |
438 | | 'thumbnail' => array( |
439 | | 'file' => 'wordpress-gsoc-flyer-pdf-116x150.jpg', |
440 | | 'width' => 116, |
441 | | 'height' => 150, |
| 438 | 'full' => array( |
| 439 | 'file' => 'wordpress-gsoc-flyer-pdf.jpg', |
| 440 | 'width' => 1088, |
| 441 | 'height' => 1408, |
442 | 442 | 'mime-type' => 'image/jpeg', |
443 | 443 | ), |
444 | 444 | 'medium' => array( |
… |
… |
class Tests_Image_Functions extends WP_UnitTestCase { |
453 | 453 | 'height' => 1024, |
454 | 454 | 'mime-type' => 'image/jpeg', |
455 | 455 | ), |
456 | | 'full' => array( |
457 | | 'file' => 'wordpress-gsoc-flyer-pdf.jpg', |
458 | | 'width' => 1088, |
459 | | 'height' => 1408, |
| 456 | 'thumbnail' => array( |
| 457 | 'file' => 'wordpress-gsoc-flyer-pdf-116x150.jpg', |
| 458 | 'width' => 116, |
| 459 | 'height' => 150, |
460 | 460 | 'mime-type' => 'image/jpeg', |
461 | 461 | ), |
462 | 462 | ), |
… |
… |
class Tests_Image_Functions extends WP_UnitTestCase { |
500 | 500 | |
501 | 501 | $expected = array( |
502 | 502 | 'sizes' => array( |
503 | | 'thumbnail' => array( |
504 | | 'file' => 'wordpress-gsoc-flyer-pdf-116x150.jpg', |
505 | | 'width' => 116, |
506 | | 'height' => 150, |
| 503 | 'full' => array( |
| 504 | 'file' => 'wordpress-gsoc-flyer-pdf.jpg', |
| 505 | 'width' => 1088, |
| 506 | 'height' => 1408, |
507 | 507 | 'mime-type' => 'image/jpeg', |
508 | 508 | ), |
509 | 509 | 'medium' => array( |
… |
… |
class Tests_Image_Functions extends WP_UnitTestCase { |
518 | 518 | 'height' => 1024, |
519 | 519 | 'mime-type' => 'image/jpeg', |
520 | 520 | ), |
521 | | 'full' => array( |
522 | | 'file' => 'wordpress-gsoc-flyer-pdf.jpg', |
523 | | 'width' => 1088, |
524 | | 'height' => 1408, |
| 521 | 'thumbnail' => array( |
| 522 | 'file' => 'wordpress-gsoc-flyer-pdf-116x150.jpg', |
| 523 | 'width' => 116, |
| 524 | 'height' => 150, |
525 | 525 | 'mime-type' => 'image/jpeg', |
526 | 526 | ), |
527 | 527 | ), |