[wp-trac] [WordPress Trac] #40370: add_image_sizes does not create the "crop position" versions of the image

WordPress Trac noreply at wordpress.org
Thu Feb 4 07:06:54 UTC 2021


#40370: add_image_sizes does not create the "crop position" versions of the image
-------------------------------------------------+-------------------------
 Reporter:  piejesus                             |       Owner:  (none)
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Media                                |     Version:  2.9
 Severity:  normal                               |  Resolution:
 Keywords:  needs-unit-tests good-first-bug      |     Focuses:
  has-patch 2nd-opinion                          |
-------------------------------------------------+-------------------------

Comment (by davidbawiec):

 @themattroyal your modification of the code works like a charm for the
 most part. Thanks!

 In PHP 7.1.33 it throws the following two Warnings:
 {{{
 Declaration of WP_Image_Editor_GD::update_crop_hash($crop, $dst_w, $dst_h)
 should be compatible with WP_Image_Editor::update_crop_hash($hash = NULL)
 }}}

 {{{
 Declaration of WP_Image_Editor_Imagick::update_crop_hash($crop, $dst_w,
 $dst_h) should be compatible with WP_Image_Editor::update_crop_hash($hash
 = NULL)
 }}}
 To fix it, I suggest renaming the instances of the code update_crop_hash()
 in the child classes to create_crop_hash().

 I've created a patch that does just that and that seems to fix the PHP
 Warnings.
 [attachment: Fix incompatible declarations PHP Warnings - patch.diff]

 Would love to hear your thoughts.
 Thanks!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/40370#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list