[wp-trac] [WordPress Trac] #34981: Usage of `image_size_names_choose` breaks JS attachment model attributes

WordPress Trac noreply at wordpress.org
Fri Sep 30 20:59:33 UTC 2016


#34981: Usage of `image_size_names_choose` breaks JS attachment model attributes
-------------------------------------+--------------------
 Reporter:  dnaber-de                |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  4.7
Component:  Media                    |     Version:  4.3.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+--------------------

Comment (by azaozz):

 I also think the use of `image_size_names_choose` in
 `wp_prepare_attachment_for_js()` is wrong. In this case it controls what
 image sizes are outputted to JS, i.e. has little to do with the original
 purpose of only filtering what is displayed in the UI.

 However removing it may introduce other errors. For example if a plugin
 adds more sizes, they will not be available in JS.

 We already always add (hard-code) the `full` size. A simple workaround
 would be to ensure that the `thumbnail` size is always present so it can
 be used in the media modal and library to display the image thumbnails.
 See 34981.3.diff.

 A better way to fix this would be to add `srcset` to these thumbnails :)

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


More information about the wp-trac mailing list