[wp-trac] [WordPress Trac] #21785: Add header image uploads with cropping to the customizer

WordPress Trac noreply at wordpress.org
Wed Mar 12 20:46:11 UTC 2014


#21785: Add header image uploads with cropping to the customizer
----------------------------+-----------------------------------------
 Reporter:  nacin           |       Owner:
     Type:  task (blessed)  |      Status:  new
 Priority:  normal          |   Milestone:  3.9
Component:  Appearance      |     Version:  3.4
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  javascript, administration
----------------------------+-----------------------------------------

Comment (by nacin):

 This is great. Really, I loved it, and it was so well done, too. In
 [27497], I made a number of changes beyond gcorne's latest patch. Most of
 them leave things to do:

  * The "Randomize" and "Randomizing" strings were not translatable, as
 they substituted words in. We always need to be translating full
 sentences. Additionally, it didn't handle plurals properly, and we don't
 have the ability to do plurals in JS, so it was removed for the moment.
 Finally, '''TODO: we shouldn't show "Randomize" or "Randomizing" when
 there is only one image''' — you can't "randomize" one image.

  * I added a `final` to the WP_Customize_Header_Image_Control class. This
 class changed significant shape and I wanted anyone who was extending it
 to get an immediate fatal error in 3.9. '''TODO: Investigate usage and
 backwards compatibility concerns.''' It's possible we just create a new
 class and empty this one, making it essentially an alias for
 WP_Customize_Image_Control, which it extends.

  * "Suggested dimensions" was removed as it was in the wrong place. This
 should be placed elsewhere, probably above "Attachment Details". '''TODO:
 Restore "Suggested dimensions", remove Title/Caption/etc. Consider
 removing "Edit Image", which doesn't make sense here.'''

  * I changed the XHR stuff to use wp.ajax.post and wp_send_json_*.
 '''TODO: All XHR requests need some kind of error handling, ideally.'''
 (There are existing tickets about this; we don't handle errors very well
 in the customizer currently, but there's a lot more things that can fail
 here.) I also removed the privilege-checking method from the main class,
 as it was an over-abstraction and hid important security checks under the
 rug.

  * I just noticed "this string must not be empty" and I'm not sure what's
 going on there. '''TODO:''' Most of that logic should not be in the
 customizer control''', but in the custom header class, so we'll have to
 figure that out.

  * The dice just isn't clear that it's a dice, not at the font size size I
 see it in, anyway. (It looks like a broken unicode character.) '''TODO: We
 should use a dashicon or nothing here.''' (It also wasn't rotating for me
 — is it supposed to?)

  * '''TODO: doCrop et. al should be moved to the models, and out of the
 views.'''

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


More information about the wp-trac mailing list