• Gal Baras

    (@galbaras)


    My media library is full of Auto Rename buttons with the recommendation to rename the files to the same name. Clicking the button makes no difference.

    I have EWWW Image Optimizer installed, as well as Regenerate Thumbnails, if this makes a difference.

    Oddly, this doesn’t happen with every image and I can’t tell the difference between cases.

Viewing 9 replies - 16 through 24 (of 24 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi Gal. It’s a bit difficult to debug this for me, as I can’t replicate it on my local install. Actually, the original filename is only matched at the beginning to decide the new name, but then it should be fine…

    I need some help from Shane so this is for him:
    Shane, how can I use your plugin to replicate this issue on my localhost? I am not sure how to “transform/rename” my files with a webp extension. I have only the JPG to PNG link. I would like to easily replicate this to debug it properly. If you have any idea about what’s happening, of course, I would love to hear.

    Thread Starter Gal Baras

    (@galbaras)

    With EWWW active and WEBP conversion configured, do this:

    1. Upload a file named “a.jpg”
    2. Look at the files being generated – all thumbnails should have a .webp file
    3. Edit the media and change the title to “B” for b.jpg to be created
    4. Look at the files again – all the .jpg files are renamed, but the .webp files stay the same, i.e. you will see b.jpg and a.jpg.webp, which is not as it should be

    I hope this helps.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Thanks @galbaras. Indeed, I didn’t notice at first but the webp have been generated. However, there is nowhere they are mentioned in the database. I had a look at the metadata but it’s not there. You mentioned before it was part of the metadata though, right?

    Otherwise, I could add a webp option (or check if EWWW or another plugin doing the same thing is used) to see if a file with the .webp extension exists and rename it as well.

    Jordy wanted me to chime in here to clarify what EWWW IO does, and to provide more information on what needs to happen with the most recent request.

    While I haven’t tested it, I suspect the new version at least doesn’t try to mangle the .webp images instead of the originals. At this point, it should be renaming the “normal” images, but orphaning the .webp files.

    So here’s what needs doing. For every image file that is renamed (originals and thumbs alike), MFR should check for the same exact filename with “.webp” appended to the end.

    For example poorly-named-image.jpg will have poorly-named-image.jpg.webp, and currently MFR just renames poorly-named-image.jpg to awesome-image.jpg, and poorly-named-image.jpg.webp is left behind.

    So what should MFR do? It should look to see if poorly-named-image.jpg.webp exists, and then rename it to awesome-image.jpg.webp. There’s no metadata to update, or anything like that, just move the .webp copy to match the new filename.

    Plugin Author Jordy Meow

    (@tigroumeow)

    @galbaras I am discussing with @nosilver4u on how to do this. It’s probable that my plugin will transmit the renaming data to EWWW and that EWWW will take care of the .webp.

    Thread Starter Gal Baras

    (@galbaras)

    This approach will only work for EWWW, then. If there is another plugin that creates WEBP copies, that plugin will also have to be adapted, and I’m not sure we can ever get an exhaustive list.

    Seems to me that WEBP simply makes sense for you to handle. To find original files to rename, add the “$” to the end of the search pattern, but when renaming all the versions of that file, use the old pattern, with no “$”, which will match things past the original extension.

    Plugin Author Jordy Meow

    (@tigroumeow)

    There is actually no choice, there is something EWWW needs to do (update its own database). Other plugins would also do it differently. If I adapt my code to the way EWWW will do it, it might end bad in other cases, and my plugin will be a maze to debug. I actually have a little API and many hooks to let the other plugins do this easily. Also, the problem is not about the $, it’s totally elsewhere ??

    Let’s hear @nosilver4u.

    I’m going to hook into the API provided by MFR and implement it there. I’m a little bit “on the fence” as to whether MFR should look for WebP images or not, but it’s pretty trivial just to do that at the same time EWWW IO is updating it’s own internal tables.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Let me know if there is any issue with the book @nosilver4u.

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘Auto rename to same file name’ is closed to new replies.