[wp-trac] [WordPress Trac] #17626: image_get_intermediate_size() may return wrong thumbnail size

WordPress Trac noreply at wordpress.org
Fri May 23 06:45:45 UTC 2014


#17626: image_get_intermediate_size() may return wrong thumbnail size
----------------------------------------+-----------------------------
 Reporter:  chipbennett                 |       Owner:  markoheijnen
     Type:  defect (bug)                |      Status:  assigned
 Priority:  normal                      |   Milestone:  Future Release
Component:  Media                       |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+-----------------------------

Comment (by roytanck):

 Replying to [comment:24 ericlewis]:
 > I've simplified the logic in attachment:17626.diff.
 >
 > In the first loop, if there's an exact match, short circuit. Otherwise,
 store any image sizes that are larger than the one requested in a hash.
 Loop back through this hash (sorted by area size), and return the first
 one.

 Looks promising. But I think `$candidate_sizes[$data['width'] *
 $data['height']] = $_size;` (line 589) could potentially cause issues with
 different crops where width*height is the same (i.e. 400px*100px and
 100px*400px images).

 That said, simply short circuiting on the exact requested dimensions would
 likely fix all the issues I've been having with this.

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


More information about the wp-trac mailing list