Support » Plugin: Converter for Media - Optimize images | Convert WebP & AVIF » Broken images won’t load on Chrome

  • Resolved buzut

    (@buzut)


    Thank you for this really neat plugin.

    Firefox reads the images without problem but Chrome can’t read some of them. I’m wondering if it’s not a PHP issue like the one mentionned here.

    Link a an image that Chrome can’t open.

    For reference, I’m using official Ubuntu 16.04 LTS PHP package (PHP 7.0.33-0ubuntu0.16.04.12).

    • This topic was modified 2 years, 11 months ago by buzut.
    • This topic was modified 2 years, 11 months ago by buzut.
    • This topic was modified 2 years, 11 months ago by buzut.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @buzut,

    Thank you for your message. I will try to help you.

    Unfortunately, it looks like a library problem. I downloaded the original photo and rendered it at home. Everything works and I also use PHP 7.0.

    Can you try a newer version of PHP? Do you have any errors in debug.log when converting?

    Thread Starter buzut

    (@buzut)

    Hi @mateuszgbiorczyk,

    Thank you for getting back to me this promptly!
    It’s definitely an issue with libwebp. When trying on some other website with different versions of PHP it works.

    It seems to be this bug. I have indeed been able to fix the image by simply zero padding it:

    
     echo "\0" >> test.webp
    

    Still, I’d rather not go away from the default distribution packages and switch to a PPA version.

    Also, your extension is that good that I’m not inclined either to switch to another one. It’s well coded and does the job 🎉

    As Ubuntu 16.04 is quite maintream and will still be around till 2024 (end of life), do you think you’d be able to add a check on the size like the one described on Stackoverflow?

    Alternatively, if native libwebp was supported (via php excec), I’d happily switch to it!

    Thanking you again Mateusz.
    Have a nice day,
    Quentin

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Thank you so much for your commitment. It helps me a lot.

    I am happy to help you in this matter.

    Are you able to edit the following file in the plugin code:
    /app/Convert/Gd.php

    Add the following code there on line 117 (before return [):
    if (filesize($output) % 2 === 1) file_put_contents($output, "\0", FILE_APPEND);

    And try to generate all the images again. Did this solve your problem?

    Thread Starter buzut

    (@buzut)

    You’re welcome, thank your for providing the community such a useful plugin. Clean code, not bloated, not trying to plug every cloud service in the universe, it’s just perfect.

    And it now works perfectly after adding the filesize & zero padding code you provided!

    I guess it’ll be in the next update 🤞
    In the meantime, the modified code works like a charm.

    Thank you very much Mateusz.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Very nice to hear it. I will definitely add it in the new update. For now, please work with this modification in the code. I am glad that I have such a community as you.

    Thank you for your help and if you could, please add your honest review. I will be grateful!

    Thread Starter buzut

    (@buzut)

    I was actually writing the review! So that’s done 😉

    Thank you very much for your work and for your great support.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Broken images won’t load on Chrome’ is closed to new replies.