• Resolved bocsek

    (@bocsek)


    Hi!

    In PhP error log I’ve seen errors related to this plugin (v5.1.6).
    [23-Feb-2021 18:38:16 UTC] PHP Warning: rename(/wp-content/uploads/2021/02/6050281-Nature-T-oszlop-drothalokhoz-es-betekintesvedelmi-keritesekhez-zold-muanyag--H-175-cm-Nature-T-oszlop-drothalokhoz-es-betekintesvedelmi-keritesekhez-zold-muanyag--H-175-cm-300x273.jpg,/wp-content/uploads/2021/02/6050281-Nature-T-oszlop-drothalokhoz-es-betekintesvedelmi-keritesekhez-zold-muanyag--H-175-cm-Nature-T-oszlop-drothalokhoz-es-betekintesvedelmi-keritesekhez-zold-muanyag--H-175-cm-Nature-T-oszlop-drothalokhoz-es-betekintesvedelmi-keritesekhez-zold-muanyag--H-175-cm-300x273.jpg): File name too long in /wp-content/plugins/media-file-renamer/classes/core.php on line 636

    After this warning, the rename stops, and some other files are skipped to rename, and the rename process is not complete, I see broken image links in Media Library.
    As you can see it’s very strange, why it append 2-3x times the new filename to the end of the thumbnails. In the above example the original filename was 6050281.jpg, and the new name I was added into the rename field in list view in media library is “-Nature-T-oszlop-drothalokhoz-es-betekintesvedelmi-keritesekhez-zold-muanyag–H-175-cm”. The original size is ok, and some thumbnails too, but some thumbnails are not:
    https://paste.pics/d3c945721f2d7c84440c92d08ddd6a52

    You can see other filenames are messed up too, luckily they are not too long.

    As a workaround I give shorter filenames, but the bug is still there in the plugin code.

    • This topic was modified 3 years, 1 month ago by bocsek.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi,

    You shouldn’t use file names longer than 255 characters. That’s a technical limit which is probably imposed by your web server, hence the issues here.

    On my side, I will make sure file names are not exceeding this size. If that happens, Media File Renamer will not do anything to avoid issues.

    Thread Starter bocsek

    (@bocsek)

    Hi Jordy!

    You misunderstood the situation. I don’t give so long filenames. In the example above I provided the following filename to the plugin:
    6050281-Nature-T-oszlop-drothalokhoz-es-betekintesvedelmi-keritesekhez-zold-muanyag–H-175-cm.jpg
    This is 94 char. The original filename was 6050281.jpg. I’ve added the text “-Nature-T-oszlop-drothalokhoz-es-betekintesvedelmi-keritesekhez-zold-muanyag–H-175-cm” into the input field of the plugin. I refer to this text as $newname to save time reading… 🙂

    What I’m observed, is that if there are only the original file, and additionally 4 thumbnails so 5 files, the renamer works well.
    For example:
    6050281.jpg -> 6050281$newname.jpg ;
    6050281-100×100.jpg -> 6050281$newname-100×100.jpg ;
    6050281-150×150.jpg -> 6050281$newname-150×150.jpg ;
    6050281-300×300.jpg -> 6050281$newname-300×300.jpg ;
    6050281-500×500.jpg -> 6050281$newname-500×500.jpg ;

    But if there are more than 4 thumbnails, the renamer get tangled up. I show you how:
    6050281.jpg -> 6050281$newname.jpg ; OK!
    6050281-100×100.jpg -> 6050281$newname-100×100.jpg ; this is OK
    6050281-150×150.jpg -> 6050281$newname-150×150.jpg ; this is OK
    6050281-300×300.jpg -> 6050281$newname-300×300.jpg ; this is OK
    6050281-500×500.jpg -> 6050281$newname-500×500.jpg ; this is OK
    6050281-700×700.jpg -> 6050281$newname$newname-700×700.jpg ; NOT_OK!
    6050281-800×800.jpg -> 6050281$newname$newname$newname-800×800.jpg ; NOT_OK!
    6050281-900×900.jpg -> 6050281$newname$newname$newname$newname-900×900.jpg ; NOT_OK!

    The renamer tries to add string $newname 3! times to the filename, that’s why I got the error filename is too long.

    On my side, I will make sure file names are not exceeding this size. If that happens, Media File Renamer will not do anything to avoid issues.

    This behavior also should be increased, because in such case, the renamer simply stop the renaming procedure, causing broken images, image links in the database.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Do you think your issue is related to this? This one: https://wordpress.org/support/topic/incorrect-thumbnails-names/#post-14137850. If yes, it would be good to stay on that topic over there, and try to find what you guys have in common. It’s a really specific issue it seems.

    Thread Starter bocsek

    (@bocsek)

    I’ve seen that topic, I think it’s not related, but quite interesting as well.
    Additional information for my case:
    WordPress version: 5.3.6
    WooCommerce version: 3.8.1 (yes, pretty old)
    Media File Renamer: 5.1.6

    Now I’ve tried to update to 5.1.8, but the issue is still here.

    I did a test rename again, I paste the logfile with my comments, hope this brings you closer to the solution.
    Original filename: embio_elonyei.png
    New filename: embio_elonyei_em-bio.png
    The rename field show embio_elonyei.png, and I added “_em-bio” text before the file extension, then hit Rename button.

    https://paste.pics/e65ab61ca07134f959cba18e0ece0d39

    Jordy, looks to me like this is due to the target file name (minus the extension) containing the original file name.

    Plugin Author Jordy Meow

    (@tigroumeow)

    I am not sure @galbaras, I think the issue was related to something else… it might be also because the server is run on Windows. I haven’t heard issues related to this for a long while though, so it’s definitely something very specific. I couldn’t replicate it unfortunately 🙁

    Thread Starter bocsek

    (@bocsek)

    The server is running on linux

    OS: Linux
    Server: Apache/2.4.25 (Debian)
    Document Root: /var/www/<removed>/web
    
    PHP
    v7.2.26-1+0~20191218.33+debian9~1.gbpb5a34b
    GD: 2.2.5
    Memory Limit: 256,0 MiB
    Max Script Execute Time: N/As
    Max Post Size: 8,0 MiB
    Max Upload Size: 2,0 MiB
    
    MYSQL
    v10.1.37-MariaDB-0+deb9u1
    Maximum No. Connections: 151
    Maximum Packet Size: 16,0 MiB
    Data Disk Usage: 233,2 MiB
    Index Disk Usage: 37,2 MiB
    Plugin Author Jordy Meow

    (@tigroumeow)

    If I share with you a fresh install of WP, do you think you would be able to replicate the issue @bocsek?

    Thread Starter bocsek

    (@bocsek)

    @tigroumeow I can try it.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @bocsek,

    Please contact me through here: http://meowapps.com/contact/. If you can replicate that issue for me, I will definitely fix this 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Wrong thumbnail rename’ is closed to new replies.