[wp-trac] [WordPress Trac] #50137: New IMG sizes (1536x1536 & 2048x2048) names fail in JS/REST

WordPress Trac noreply at wordpress.org
Sat May 9 19:56:15 UTC 2020


#50137: New IMG sizes (1536x1536 & 2048x2048) names fail in JS/REST
--------------------------+-----------------------------
 Reporter:  bahia0019     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  5.4.1
 Severity:  normal        |   Keywords:
  Focuses:  rest-api      |
--------------------------+-----------------------------
 Additional sizes were added in 5.3. This was a very important fix.

 However because the names were named the actual dimensions as integers,
 and not strings, the names create invalid syntax errors in JS.

 For example the first variable below works properly. But the second kicks
 out a syntax error due to the integers. However, that is the actual
 endpoint.
 {{{
   const largeSource = slide.media_details.sizes.large.source_url
   const fullscreenSource = slide.media_details.sizes.1536x1536.source_url
 }}}

 The solution would be to remove the dimensions, and provide names as
 strings.
 I've proposed the names to be Oversize and Fullscreen in the past.
 But open to additional ideas.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50137>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list