[wp-trac] [WordPress Trac] #35390: image_constrain_size_for_editor() should not affect images generated on the front end when `large` size is used.
WordPress Trac
noreply at wordpress.org
Thu May 4 18:31:07 UTC 2017
#35390: image_constrain_size_for_editor() should not affect images generated on the
front end when `large` size is used.
------------------------------------------+-----------------------------
Reporter: rabmalin | Owner: joemcgill
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: Future Release
Component: Media | Version: 4.4
Severity: normal | Resolution:
Keywords: needs-unit-tests needs-patch | Focuses:
------------------------------------------+-----------------------------
Comment (by pressupinc):
My business partner and I are trying to make progress on this ticket. We
like @joemcgill's suggestion to have functions call
`image_constrain_size_for_editor()` directly, rather than doing it through
`image_downsize()`.
So we looked at the five functions that call `image_downsize()`, and we've
broken them into what we think (but aren't sure) should and should not
call `image_constrain_size_for_editor()`:
----
''Yes''
`get_image_tag()` - we're pretty sure this is what actually generates
images in the TinyMCE Visual Editor, so it should be scaled in an Editor
context.
''No''
`wp_xmlrpc_server::_prepare_media_item()` - can't be in admin if xmlrpc
`wp_get_attachment_thumb_url()` - its only caller is
`get_attachment_icon_src()`, which isn't admin-y and is deprecated
`image_size_input_fields()` - This only seems to be used by a Flash-based
legacy media uploader. We're pretty sure that shouldn't be aware of the
editor's image size constraints, but we're not sure; perhaps it should?
`wp_get_attachment_image_src()` - just based on the name, it should just
be giving you dimensions that aren't adulterated by editor considerations.
----
`wp_get_attachment_image_src()` is really tricky, though, because it's
called in a further fifteen functions, and we don't know if TinyMCE is
using any of those in its process of rendering images in the Visual
editor.
This relates to a more general question: Is
`image_constrain_size_for_editor()` ''just'' for making sure that the
TinyMCE Visual Editor doesn't attempt to render 5000px-wide images? Or is
it used for another purpose, somewhere else in the admin?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35390#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list