• Hi!
    This bug happens with version 3.18.
    1) I upload an image in a post via ACF gallery
    2) The file name works fine.
    3) I save the post
    4) Every image in the gallery loses its file name. You get “.jpg” and the image file name is blank (both in media gallery and uploads folder).
    This makes the frontend image to not be found and also in the media library.

    This bug is not present in version 1.37.2, everything works fine in that version.

    I have wordpress 6.3

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Shabti Kaplan

    (@shabti)

    @carlosvai

    thanks for reporting this issue. We will get this fixed ASAP

    Thread Starter carlosvai

    (@carlosvai)

    Thank you for your excellent work!

    I am having an issue where each image upload, for the posts featured image, the image file gets a “.” added in front and its creating the same issue.

    Thread Starter carlosvai

    (@carlosvai)

    @ktchup my advice is to roll back to version 3.17.2 and wait for a fix.

    Plugin Author Shabti Kaplan

    (@shabti)

    @carlosvai @ktchup

    We pushed a fix for this issue in 3.18.1

    Thread Starter carlosvai

    (@carlosvai)

    Great to know! thanks a lot!@shabti

    Thread Starter carlosvai

    (@carlosvai)

    I’ve just tested, but I’m having the same issue.
    Let me give some more details to replicate.

    The problem happens when you upload images to a gallery field in the backend, save the post, and then upload another image and re-save.

    When you go to the media library after that process, you get this
    https://ibb.co/xhT5mGt

    The image does not have a file name, but not only that, it also makes disappear the file name of the other images already present in the gallery.
    I hope that makes sense.

    Plugin Author Shabti Kaplan

    (@shabti)

    @carlosvai

    Thanks for the helpful details. I was able to reproduce the bug and I pushed another fix. Thank you for your help and patience

    Thread Starter carlosvai

    (@carlosvai)

    @shabti thank you for your support with this amazing plug in.

    I tested again, is adding “-1” to every image file name.
    https://ibb.co/1QbSwSq

    Maybe not the first time, but if you save the post and then add a new image, you will see that appended number in all images in the gallery.

    Hi @shabti I’m on 3.18.2 and it’s adding a “.” as well as renaming the file completely, resulting in broken images.

    I’m rolling back for now, but wanted to give you a heads up.

    I identified the pro version to be the issue by the way!

    Plugin Author Shabti Kaplan

    (@shabti)

    @carlosvai

    Is this happening to a file that you hadn’t uploaded already once before?

    Plugin Author Shabti Kaplan

    (@shabti)

    @juliemclelland

    You mean this is happening when you activate the pro version but not when you activate the free version?

    Thread Starter carlosvai

    (@carlosvai)

    @shabti exactly. If I upload a new image in a gallery, when I save the post, all other images get renamed too.

    In 3.18.1 the name gets erased and only the .jpg remains.
    And in 3.18.2 it prepends the number of the ACF field.

    3.17.2 works perfectly.

    I have the free version, so it’s not only a pro version issue.

    We got it to kind of work using this code (meaning it’s still wonky, but it’s showing images):

    add_filter('wp_handle_upload_prefilter', 'custom_upload_filter',20 );
    
    function custom_upload_filter( $file ) {
    // Check if the file is an image.
    if ( strpos( $file['type'], 'image/' ) === 0 ) {
    $random_number = rand(1000, 9999); // Generate a random number between 1000 and 9999
    $file['name'] = 'dw-' . $random_number . '-' . $file['name'];
    }
    return $file;
    } add_filter( 'wp_unique_filename', 'add_dw_and_random_to_filename', 10, 4); function add_dw_and_random_to_filename($filename, $ext, $dir, $unique_filename_callback) {
    $new_filename = 'dw-' . rand(1000, 9999) . '-' . $filename;
    return $new_filename;
    } function upload_dir_filter($uploads)
    {
    $day = date('d');
    $uploads['path'] .= '/' . $day;
    $uploads['url'] .= '/' . $day;
    return $uploads;
    }
    add_filter('upload_dir', 'upload_dir_filter');

    But with this, if Pro is activated, it doesn’t work at all.

    Edited to add:

    • I took out the above code ^ and deactivated the pro version and it’s working fine on 3.17.2. But since I couldn’t rollback the pro version, it interferes with the 3.17.2 version.
Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Image upload with empty file name’ is closed to new replies.