• Resolved mathieu

    (@mathieu)


    It is a bug that has been going on for a while… It looks for the compressed image at :

    /home/xxx/public_html/wp-content/blogs.dir/123456/files/files/2020/11/capturechandail.webp

    This should be

    /home/xxx/public_html/wp-content/blogs.dir/123456/files/2020/11/capturechandail.webp

    I used to correct it with that code :

    add_filter('shortpixel_webp_image_base', 'correctBaseShortPixelWebP', 1, 1); 
    
    function correctBaseShortPixelWebP($base) { 
    
    return str_replace("/files/files/", "/files/", $base); 
    
    }

    But the filter is not active anymore and I don’t know how to fix this.

    Any clue?

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

    (@petredobrescu)

    Hi @mathieu,

    I’m sorry to hear this! I admit we’re doing the multisite tests on newer installs, without the blogs.dir folder structure, so this is why haven’t seen (and fixed) this bug.

    Can you please share the WordPress and PHP versions that you’re running, as well as the type of install (sub-folders or sub-domains)?

    Thanks!

    Thread Starter mathieu

    (@mathieu)

    Hi Pedro,

    Thank you very much for your help.

    I run php7.3, WordPress 6.2.2 with a Multisite sub-domains install.

    Cheers,

    [ Please do not bump. ]

    Plugin Author Pedro

    (@petredobrescu)

    Hello @mathieu,

    I’m sorry for the delay in getting back to you. Please find below a dev version that contains a fix for the situation you described:

    https://shortpixel.com/downloads/shortpixel-image-optimiser-5.4.1-DEV02.zip

    If possible, can you please install this version on a dev/staging copy of your site and let me know if it fixes the issue?

    Thanks, I look forward to getting your confirmation!

    Thread Starter mathieu

    (@mathieu)

    Hi Pedro,

    Sadly, I don’t have the dev environnement to test that out right now.

    I did fix it myself in the meantime tho.

    add_filter('shortpixel/filesystem/processFilePath', 'correctSPIOPath', 2, 999);
    
    if (!function_exists("correctSPIOPath")) {
    
    function correctSPIOPath($path, $original_path)
    
    {
    
    return str_replace("/files/files/", "/files/", $path);
    
    }
    
    }

    Thanks

    Plugin Author Pedro

    (@petredobrescu)

    Thanks for your reply @mathieu. Since my reply we ran more testing and I’m now pretty sure the issue has been resolved for good, therefore, when version 5.4.1 is released I recommend you upgrade, then disable your filter to check that everything works as expected. That would be highly appreciated!

    Thank you

    Thread Starter mathieu

    (@mathieu)

    I will absolutely test it out… Do you know approximately when it is going out?

    I will write myself a calendar note to test it out and come back to you with the results.

    Thanks

    Plugin Author Pedro

    (@petredobrescu)

    Hello @mathieu,

    Version 5.4.1 has just been released ??

    Looking forward to getting your confirmation about this issue!

    Thread Starter mathieu

    (@mathieu)

    It’s actually worse to be fair…

    5.4.1 return path :

    /home/xxx/public_html/2023/09/xxxx.jpg

    5.4.0 returned :

    /home/xxx/public_html/wp-content/blogs.dir/123435/files/files/2023/09/xxxx.jpg

    It was at least an easy replace.

    Thread Starter mathieu

    (@mathieu)

    Fixed it this way…

    // Old version 5.4.0

    $path = str_replace(“/files/files/”, “/files/”, $path);

    // New version 5.4.1

    if (!strstr($path, “wp-content”)) {

    $upload_dir = wp_upload_dir();

    $upload_dir[‘basedir’];

    return str_replace(ABSPATH, trailingslashit($upload_dir[‘basedir’]), $path);

    }

    Thread Starter mathieu

    (@mathieu)

    Can you tell me in which files / lines, that decision is taken? I’ll quickly find it out. I am running Multisite since before it was even Multisite.

    I’ve seen them all.

    • This reply was modified 1 year, 6 months ago by mathieu.
    Plugin Author Pedro

    (@petredobrescu)

    Hi @mathieu,

    After some further testing I’ve been able to reproduce your situation, too. Please allow us a bit more time to test this further. There are so many possible combinations of environments and constants that it becomes challenging to get it right in all the cases.

    Thanks again for your patience!

    P.S. we also have this filter that might be more appropriate to use until we sort this out:

    $abspath = apply_filters('shortpixel/filesystem/abspath', $abspath );

    https://github.com/short-pixel-optimizer/shortpixel-image-optimiser/blob/master/class/Controller/FileSystemController.php#L271

    Thread Starter mathieu

    (@mathieu)

    Let me know when you have a new fix. I’ll try it again and keep you updated.

    Best regards

    Plugin Author Pedro

    (@petredobrescu)

    Hello again, @mathieu,

    Here’s another attempt, hopefully this time we managed to get it fully resolved:

    https://shortpixel.com/downloads/shortpixel-image-optimiser-5.4.2-DEV01.zip

    Please test it and let me know if it resolves the issue!

    Many thanks for your patience and support with this.

    Thread Starter mathieu

    (@mathieu)

    Like I told you earlier, I don’t have the proper test environment to try the dev version.

    But if you can notice me when 5.4.2 goes out, I will update it and test it thoroughly.

    Best regards

    Plugin Author Pedro

    (@petredobrescu)

    Hello @mathieu,

    Version 5.4.2 was released yesterday. Please test with it and let me know if it works. I hope we finally nailed it!

    I look forward to getting your confirmation about it.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Avif & Webp not loading on multisite…’ is closed to new replies.