[wp-trac] [WordPress Trac] #19793: In image editor, editing thumbnail has no effect if crop is exactly size of thumbnail

WordPress Trac noreply at wordpress.org
Tue Oct 28 17:54:03 UTC 2014


#19793: In image editor, editing thumbnail has no effect if crop is exactly size of
thumbnail
--------------------------+-------------------------
 Reporter:  janmakinen    |       Owner:  ericlewis
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  4.1
Component:  Media         |     Version:  3.3.1
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |     Focuses:  javascript
--------------------------+-------------------------
Changes (by mboynes):

 * keywords:   => has-patch


Comment:

 I took a look at this and found
 [https://github.com/WordPress/WordPress/blob/3949a8b6cc50a021ed93798287b4ef9ea8a560d9
 /wp-includes/media.php#L505-L507 the culprit]:

 {{{
 // if the resulting image would be the same size or larger we don't want
 to resize it
 if ($new_w >= $orig_w && $new_h >= $orig_h)
         return false;
 }}}

 Looks like this code has been this way
 [https://github.com/WordPress/WordPress/commit/de3ab9a05ec243354252e450c7ef06b572f088a6
 since `image_resize_dimensions()` was added].

 Patch forthcoming which accounts for the condition when the destination
 width is the same as the original (selected) width, and the destination
 height is the same as the original height. Current unit tests pass, and I
 added a single unit test for `image_resize_dimensions()`.

 Open to suggestions for other unit tests to add, or if anyone can think of
 any situations where this would not work or would cause unexpected
 behavior.

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


More information about the wp-trac mailing list