[wp-trac] [WordPress Trac] #27910: Resizing an image to a changed ratio with wp_get_image_editor does not work. Only resizes one side.

WordPress Trac noreply at wordpress.org
Sat Apr 19 04:21:25 UTC 2014


#27910: Resizing an image to a changed ratio with wp_get_image_editor does not
work. Only resizes one side.
--------------------------+-----------------------------
 Reporter:  donrhummy     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  3.8.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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:

 {{{#!php
     //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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27910>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list