[wp-trac] [WordPress Trac] #54605: WP_Image_Editor_Imagick::resize is not behaving according to spec

WordPress Trac noreply at wordpress.org
Thu Dec 9 14:17:46 UTC 2021


#54605: WP_Image_Editor_Imagick::resize is not behaving according to spec
--------------------------+-----------------------------
 Reporter:  chillhoptom   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  trunk
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 According to docs, you should be able to pass int|null as either $max_w or
 $max_h

 {{{#!php
 WP_Image_Editor_Imagick::resize( int|null $max_w, int|null $max_h, bool
 $crop = false )
 }}}

 Inside the function, $max_w and $max_h are directly passed to
 image_resize_dimensions

 {{{#!php
 image_resize_dimensions( int $orig_w, int $orig_h, int $dest_w, int
 $dest_h, bool|array $crop = false )
 }}}

 This function does not accept int|null for either $dest_w or $dest_h and
 will return false, which causes WP_Image_Editor_Imagick::resize to return
 a WP_Error.

 For example:

 {{{#!php
 $editor->resize(1000,null);
 }}}


 will return a WP_Error while according to the documentation it should
 resize based on $max_w alone.

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


More information about the wp-trac mailing list