[wp-trac] [WordPress Trac] #48453: Regression: Implied contract between image sub-size filenames and their base filename now broken

WordPress Trac noreply at wordpress.org
Mon Oct 28 22:42:02 UTC 2019


#48453: Regression: Implied contract between image sub-size filenames and their
base filename now broken
-------------------------------------+---------------------
 Reporter:  ianmjones                |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  5.3
Component:  Media                    |     Version:  trunk
 Severity:  major                    |  Resolution:
 Keywords:  needs-patch 2nd-opinion  |     Focuses:
-------------------------------------+---------------------
Changes (by azaozz):

 * keywords:   => needs-patch 2nd-opinion
 * milestone:  Awaiting Review => 5.3


Comment:

 Moving to 5.3 for consideration.

 Yes, it's always been "problematic" to find the attachment ID from an
 image URL, and the new functionality in 5.3 makes it even harder. It is,
 as mentioned, not the proper way to do things, but it was a more or less
 viable fallback.

 Been wondering if there should be a better `image_url_to_attachment_id()`
 function in core to help with these cases. Not having the expected `wp-
 image-####` class name also means these images don't have `srcset` and
 `sizes` attributes, or at least not the values generated in core.

 At first look at the proposed solutions thinking that moving/renaming of
 the originally uploaded file is the better one. This was also considered
 in the big image ticket. The argument against was that renaming the
 original image may introduce another (very small) possibility of errors
 while post-processing images, while saving another image is proven to work
 properly at that time. Also thinking that appending only `-original` or
 perhaps `-wp-original` to the file name should be sufficient. There are
 cases where it can reach length limits.

 Any other thoughts/ideas?

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


More information about the wp-trac mailing list