WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #40370, comment 17


Ignore:
Timestamp:
08/24/2019 04:53:05 AM (8 weeks ago)
Author:
azaozz
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #40370, comment 17

    initial v1  
    11There was a discussion in the [https://wordpress.slack.com/archives/C02SX62S6/p1566609255394300?thread_ts=1566481102.355100&cid=C02SX62S6 #core-media channel on Slack] about image sub-size names and file names.
    22
    3 There are several related tickets and couple of ideas about how to fix them. Generally the solution seems to be to add a short hash to image sub-size file names (like in 40370.diff) but in order to fix the file name clashing with `-WxH`, it would need to add that hash in all cases, not just for cropped images. Then the hash can be generated from the sub-size settings array. For example:
     3There are several related tickets and couple of ideas about how to fix them. Generally the solution seems to be to add a short hash to image sub-size file names (like in 40370.diff) but in order to fix the file name clashing with original files named like `my-image-file-name-800x600.jpg`, it would need to add that hash in all cases, not just for cropped images. Then the hash can be generated from the sub-size settings array. For example:
    44{{{
    55$size_settings = array (
     
    3131}}}
    3232
    33 Yet another idea is to append `-1`, `-2`, etc. to the file name (before the `-WxH` part) when testing for unique file name. That will be a bit more complex in case of sizes with the same dimensions and different crop values. It will have to keep previously tested and approved file names in cache and test/increment against them too.
     33Yet another idea is to append `-1`, `-2`, etc. to the file name (before the `-800x600` part) when testing for unique file name. That will be a bit more complex in case of sizes with the same dimensions and different crop values. It will have to keep previously tested and approved file names in cache and test/increment against them too.
    3434
    3535Related: #42437.