Support » Plugin: Media File Renamer - Auto & Manual Rename » Broken Images After Renaming

  • Resolved Dave

    (@csn123)


    I’ve been using the plugin for ages and it is really helpful. Lately, however, since the last update of WordPress, it no longer does what it used to.

    I upload images to my posts in the Gutenberg editor. I use the Media Library to fill in the title/alt tags. I save the post. Up until recently, when I save the post in the editor, behind the scenes it renamed the image and updated the image reference in the post.

    Now, it updates the URL in the Media Library but doesn’t update the post, leaving it with broken image URLs left, right and centre.

    I don’t know if this is a bug caused by the plugin/Gutenberg, or if it was a happy accident that it always used to work in this way but should not have done. I suspect the issue is that Gutenberg uses a different type of architecture and the plugin cannot successfully update the image blocks that use the renamed image.

    In case it helps, I’m running WP 5.5 with v5.5 of the plugin, with ‘on upload’ and ‘Rename on Post Save’ both checked in the settings. I also have both options in the ‘Side Updates’ box checked.

    • This topic was modified 6 months, 3 weeks ago by Dave. Reason: Better title
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @csn123,

    I would like to start with something important first: Media File Renamer works fine and updates the content of posts written with the Gutenberg Editor. What doesn’t work is to modify media entries while editing a post with the On Post Save option enabled.

    With the latest version (5.0.0), actually released today:

    Classic Editor

    It works with the On Post Save option, I have tested it and worked on it again ๐Ÿ™‚ At every post save, the media entries attached to that post are analyzed, renamed if need to be, and the content of the post updated. Since page is reloaded, the content of the post editor is also up to date.

    Gutenberg Editor

    It’s disabled now, it doesn’t do anything, so it shouldn’t break your posts. If you modify your titles while being in the post editor, you will be able to rename them automatically later (from the Media Library or the Renamer Dashboard). It’s impossible to rename filenames in the Gutenberg Post Editor. With Gutenberg, everything is done on the client-side, so updates from the server are totally ignored.

    In prior versions, I am actually not so sure. It’s possible that trying to do this was breaking the posts. But since the option has the mention “Unsafe” next to it, I doubt many users did it, hence the few feedbacks. I would be happy if you could check that it doesn’t break your posts even if your attempt to do this now. Can you check? ๐Ÿ™‚

    But yes, sorry about this… I am not totally happy with the way Gutenberg was built, it caused many issues, and not only for this option, but for many other plugins as well.

    Thread Starter Dave

    (@csn123)

    @tigroumeow Thanks for your speedy response. I can sympathise with your comments on Gutenberg. It’s a right old pain to work with compared to the classic editor.

    I’ve just installed v5. The settings UI looks much better now.

    I can’t see the rename option in the Media Library any more in list view ๐Ÿ˜ญ The column with the rename button has vanished. I’ve enabled ‘Manual Rename’ in the options but the buttons don’t appear.

    Separately, I uploaded an image to the post, edited the image alt/title in Media Library from within the post, saved the post, and exited. Neither the image URL nor the post have been updated with the clean URLs.

    I disabled ‘rename on post save’ to test and it made no difference.

    Thread Starter Dave

    (@csn123)

    @tigroumeow I had a thought on Gutenberg. If the URL can’t be updated in the block, can the Renamer plugin rename files on the fly in the media library while editing a post?

    E.g. Create post. Upload image. While in the post, click on ‘Media Library’ under ‘Replace’. Rename alt/title on the image. At that point, can the Renamer rename that file on the fly, so selecting the image uses the latest clean URL?

    Plugin Author Jordy Meow

    (@tigroumeow)

    Iโ€™ve just installed v5. The settings UI looks much better now.

    Normally, everything else looks also much better ๐Ÿ™‚ The filename editor, and the Renamer Dashboard.

    I canโ€™t see the rename option in the Media Library any more in list view ๐Ÿ˜ญ

    Can you check your Developer Tools Console (Chrome)? Do you see any error? If you click on Screen Options (top of the Media Library), do you see the Renamer column there? Is it checked?

    Separately, I uploaded an image to the post, edited the image alt/title in Media Library from within the post, saved the post, and exited. Neither the image URL nor the post have been updated with the clean URLs.

    Do you mean that the image wasn’t renamed in the post, even though it should have? Is the post broken?

    I had a thought on Gutenberg. If the URL canโ€™t be updated in the block, can the Renamer plugin rename files on the fly in the media library while editing a post?

    I think you are talking about hacking the Select or Upload Media modal, in fact ๐Ÿ™‚ And yes, if I could do this, the filename we insert would be good. Unfortunately, that would really need to be a hack, I am pretty sure I could find a way to do this, but it could break in so many ways (and you know how this ends). If there was a clean way to do it, I would definitely do, but unfortunately there isn’t ๐Ÿ™

    Thread Starter Dave

    (@csn123)

    Can you check your Developer Tools Console (Chrome)? Do you see any error? If you click on Screen Options (top of the Media Library), do you see the Renamer column there? Is it checked?

    No column in Media Library, nor is there an error in the console, nor is there a checkbox for Renamer under the ‘Screen options’ panel. I’m using Firefox 79.0.

    I’ve checked the manual mode option in the settings but it doesn’t seem to honour this option.

    Do you mean that the image wasnโ€™t renamed in the post, even though it should have? Is the post broken?

    Correct, the image didn’t rename. I suspect that might have something to do with the missing option though.

    I think you are talking about hacking the Select or Upload Media modal…

    I am! My thought was that if the image could be renamed prior to selecting the image within the post, it would stop the images from being broken in the post (once they are renamed but the post references aren’t updated). It may well be that v5 fixes this issue once I can get the manual rename option back again.

    @tigroumeow I’ll turn on the log to see if anything gets caught by that to give further clues as to what’s going on.

    Thread Starter Dave

    (@csn123)

    I turned logging on @tigroumeow .

    Loading the media library didn’t trigger any logged events.

    I uploaded an image. No events logged.

    I edited the image title/alt via the Media Library > Edit panel. This triggered a ‘Event: Save Attachment’ log, but the file didn’t rename as expected. It continued to have the same ugly filename as uploaded.

    No console errors throughout this process.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @csn123,

    There is actually currently an issue, if no method for Auto is selected, the field is not appearing in the Media Library or the Media Edit. Since I do not want to push too many updates too quick, I am waiting for other potential issues today, to fix, just in case.

    Can you contact me here? https://meowapps.com/contact
    I would like to share with you the new version so that you get this field back.

    I would also like to make sure of this: with Gutenberg, and On Post Save enabled, the images in the posts aren’t renamed/processed when the post is actually saved. It’s important, as if it happens, the images in the posts will be broken.

    I should actually disable that option completely if Gutenberg is enabled (or not overriden by the Classic Editor), with a little warning next to the option.

    Thread Starter Dave

    (@csn123)

    @tigroumeow I’ve contacted you with subject ‘Broken Images After Renaming’.

    Many thanks for your help.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Broken Images After Renaming’ is closed to new replies.