Make WordPress Core

Opened 10 years ago

Closed 8 years ago

#27910 closed defect (bug) (invalid)

Resizing an image to a changed ratio with wp_get_image_editor does not work. Only resizes one side.

Reported by: donrhummy's profile donrhummy Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8.3
Component: Media Keywords:
Focuses: Cc:


I attempted to resize an image from (300w x 225 h) to (294w x 294h) but instead it sizes it to (294w x 225 h).

This is an issue with WordPress as I have ImageMagick installed and when using ImageMagick directly, it properly resizes the image.

Relevant code:

    //This image is 300 x 225
    $image = wp_get_image_editor( "/var/www/wp-content/uploads/2014/03/test.jpg" );

    //I tell it to resize to 294 x 294
    $image->resize( 294, 294, true ); //Passing "false" to crop doesn't help either)
    //It saves, but as 290 x 225!
    $image->save( "/var/www/wp-content/uploads/2014/03/test-22.jpg" );

No errors were returned.

Change History (2)

#1 @SergeyBiryukov
10 years ago

Looks like resizing to 294x294 would require upscaling on one side, which we don't currently support.

Related: #21294, #23713, #26381.

Last edited 10 years ago by SergeyBiryukov (previous) (diff)

#2 @chriscct7
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.