• 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 15 replies - 1 through 15 (of 24 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    It shows you the ideal filename before you click on the button, so many media would have the same one. But once you click, then… it would tell you that the ideal filename exists already. Can I see a screenshot?

    Also, it depends on the directory where the image is, there might be images in a different directory and in that case, they can have the same filenames.

    Thread Starter Gal Baras

    (@galbaras)

    Hi Jordy,

    Looks like your lovely plugin sees the .png.webp and jpg.webp versions of images as conflicting. Probably because your search pattern isn’t matching the end of the filename.

    Screenshots:

    https://1drv.ms/u/s!AvYtwWI4b_-wmFWHJfDBsfDpSeUy – media library

    https://1drv.ms/u/s!AvYtwWI4b_-wmFYrlVtU2H2Mr0W4 – renamer scan results

    Cheers,
    Gal

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi Gal,

    Actually, where do you see it’s conflicting in your screenshots? :p It just proposes you a new name. Maybe I am just missing the point?

    Thread Starter Gal Baras

    (@galbaras)

    The names are identical to what’s already there, e.g. “motivating-kids.png”, and in the scan results, you can see it listing .webp files, which it shouldn’t do, because the correctly-named file also exists, but looks like it isn’t the one picked up.

    EWWW generates WEBP copies of the images, but it doesn’t remove the JPEG or PNG originals (although it does optimise them). Again, I think that the way your plugin is finding files causes it to find the WEBP versions.

    Could there be some JavaScript involved in this? The website in question serves WEBP versions to capable browsers via a script, so anything working in a browser and requesting a JPEG/PNG file may end up getting a WEBP version instead.

    Please note that this doesn’t happen to every file and that Regenerate Thumbnails seems to be having the same issue ??

    I will also report this to the author of EWWW, just in case.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Can you install this plugin?

    https://www.ads-software.com/plugins/media-meta/

    It will tell you what is exactly registered in the meta of this media, and might explain why the renaming (or something else) doesn’t work.

    Actually, webp is only supported by Chrome I think, and I am not sure why and how it is used by your install, but it shouldn’t replace your original media for sure… so that’s a bit weird you have it here.

    Thread Starter Gal Baras

    (@galbaras)

    Hi Jordy,

    Please don’t mark this issue as “resolved” when it isn’t.

    According to https://caniuse.com/#search=webp, WEBP is supported by 74.9% of all browsers and 80.27% of mobile browsers, so I’d say it’s worth the investment. Your help will be much appreciated.

    I’ve checked meta data for images, which the renamer shows as having a “.webp” extension in “Current Filename”. There are none. Your code seems to be using the meta key “_wp_attached_file” and every image meta value ends in “.jpg”, “.png” or “.gif”, including images with issues.

    Where in the code could “Current Filename” be retrieved or changed to the incorrect one? I didn’t find any place where you’re checking the actual filename, but maybe I missed it.

    Importantly, the site in question uses the Pro version of EWWW, which uses cloud optimisation, and Cloudflare. Please let me know if either of these makes a difference to what we’re dealing with here.

    Thanks again,
    Gal

    Thread Starter Gal Baras

    (@galbaras)

    I’ve found matching .webp extensions in the _wp_attachment_metadata meta. Not sure which plugin stores this information, but Media File Renamer certainly uses AND updates it.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi,

    I have tried to replicate the issue, but couldn’t. Or maybe it is an incompatibility with EWWW? But I have never heard of it until now, so I really wonder about this.

    Would you mind trying to replicate the issue on a minimal install that I provide to you? That would be the simpler. You show me the bug on a fresh and simple install, I debug it, and resolve the issue quickly.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @galbaras Don’t post email addresses in these forums. Those get deleted when found.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Actually @galbaras, @jdembowski is right. More generally, never let your email exposed anywhere on the web ?? Also, Pro support can’t be provided on the WP forums as they concern a different plugin. Support link: https://meowapps.com/support.

    Thread Starter Gal Baras

    (@galbaras)

    Hey Jordy,

    I hear there’s been a revelation. When is a fix coming?

    Can you please include a correction function for retrofitting existing image data?

    Cheers,
    Gal

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi,

    Indeed Gal, maybe! So with a little change, it seems it will work. Can you try?

    In the core.php file in the plugin, replace the line:

    if ( preg_match( "/" . preg_quote( $filename ) . "/{$i}", $file ) ) {

    by

    if ( preg_match( "/" . preg_quote( $filename ) . "$/{$i}", $file ) ) {

    Then check if it works. I tried and it worked for me. Unfortunately, a function that backfix all this is impossible to made. But you could use the Undo function, maybe? I am not sure, the issue is a bit tricky and I don’t know how it affects the install. But the Undo should work.

    Thread Starter Gal Baras

    (@galbaras)

    Hey Jordy,

    Yep, that fixed it. Looks like it also fixed thumbnail regeneration, although I’m not sure how.

    Can you please update the plugin, so that my change is not overwritten, and for the benefit of other people?

    Thank you,
    Gal

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi Gal,

    Ok! I checked a few more things and created a new version, including this fix. Everything should be good ??

    Thread Starter Gal Baras

    (@galbaras)

    Hi Jordy,

    Sorry, but although the plugin now recognises the correct authoritative name for images, it doesn’t rename their WEBP copies.

    I think that “$” should only apply when searching for original images names, but not when renaming.

    Can you please fix this?

    Thanks again,
    Gal

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