[wp-trac] [WordPress Trac] #17262: wp_get_attachment_thumb_file should check new 'thumbnail' image size

WordPress Trac noreply at wordpress.org
Mon Apr 18 06:27:58 UTC 2016


#17262: wp_get_attachment_thumb_file should check new 'thumbnail' image size
-----------------------------------------------------+------------------
 Reporter:  lonnylot                                 |       Owner:
     Type:  enhancement                              |      Status:  new
 Priority:  normal                                   |   Milestone:  4.6
Component:  Media                                    |     Version:  3.0
 Severity:  normal                                   |  Resolution:
 Keywords:  good-first-bug has-patch has-unit-tests  |     Focuses:
-----------------------------------------------------+------------------

Comment (by swissspidy):

 Replying to [comment:9 nacin]:
 > 'thumb' is the old-style thumbnail, prior to proper intermediate sizes
 ('thumbnail' / 'medium' / 'large').
 >
 > wp_get_attachment_thumb_url() does return the newer 'thumbnail' if it
 exists, and falls back to wp_get_attachment_thumb_file() if it does not.
 >
 > You can see a bit of code history in image_downsize(): "fall back to the
 old thumbnail" in a code comment.
 >
 > Not sure what _file() should return in a deprecated situation. _url() is
 basically the old-school form of wp_get_attachment_image_src( $size =
 'thumbnail' ), which returns array( $src, $width, $height ). Which is kind
 of lame.
 >
 > So, perhaps they can both be updated to work on 'thumbnail', and then
 left, as `wp_get_attachment_thumb_url()` is definitely easier, nicer, and
 more obvious to use than `wp_get_attachment_image_src()['url']`, and
 according to MarkJaquith, is widely used by plugins (probably for that
 reason).

 `wp_get_attachment_image_url()` is a simple wrapper around
 `wp_get_attachment_image_src()['url']` and available since 4.4.

 I'd be in favour of deprecating `wp_get_attachment_thumb_url()` in favour
 of that function. It's currently nowhere used in core except for
 `get_attachment_icon_src()`, which is deprecated.

 After that, we could also think about deprecating
 `wp_get_attachment_thumb_file()`, but I guess we can leave it for now as
 it's currently used in `image_downsize()` .

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


More information about the wp-trac mailing list