Support » Plugin: Autoptimize » Woocommerce product image problems

  • Resolved fifteenwheat

    (@fifteenwheat)


    Hi there!

    I have a problem with woocommerce images!
    If I enable the “Optimize Images” setting it stops zooming in the image as i hover above it. It just shows a smaller version of the image, that follows the cursor. If I uncheck this option it starts to work again, but I’d need the images to be optimized, because they load very slowly any other way.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    so do you also have “lazyload images” active in Autoptimize? does the problem go away with that option un-checked?

    I have lazyload images turned off

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    seems the “zoom” effect relies on the image being loaded at a higher resolution, which is exactly what image optimization tries to prevent from happening, so you will likely have to exclude those images from being optimized fifteenwheat. you can do so with below code snippet;

    
    add_filter('autoptimize_filter_imgopt_noptimize','imgopt_excl');
    function imgopt_excl() {
      return 'zoomImg';
    }

    Thank you!

    Where should I put this code snippet? I tried to put it in my theme’s functions.php, header.php, index.php, my custom-codes.php, and also into autoptimize’s index.php, also i tried it in my wp-config.php, and wp-settings.php, but none of them fixed the issue. After adding the code, i always deleted my cache, and did a full reload in my browser before, and after deleting the cache.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    The easiest & safest solution is using the code snippets plugin. And when done make sure to clear (all) your page cache(s).

    I added it via the code snippets plugin, cleared the cache (with the button on top of admin bar, and also saved the settings (i changed nothing) with clearing all the cache), but it still doesn’t work 🙁

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, but that’s Autoptimize cache, I assume you also have page caching (plugin or at hosting), did you clear that cache as well?

    fifteenwheat

    (@fifteenwheat)

    I have no page caching enabled. I am going to install a plugin, but wanted to resolve this problem first, so it won’t interfere.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, can you try below code snippet instead?

    add_filter('autoptimize_filter_imgopt_noptimize','imgopt_excl');
    function imgopt_excl() {
      return 'wp-post-image';
    }
    fifteenwheat

    (@fifteenwheat)

    I tried added it alone, added it in combination with the one mentioned earlier, deleted Autoptimize’s cache (both times), reloaded the page, but it still did not work 🙁

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    how/ where did you add the code-snippet fifteenwheat ?

    fifteenwheat

    (@fifteenwheat)

    I added it via the Code Snippets plugin. Created a new snippet, set it to run everywhere, pasted the code, clicked save and activate. After that i deleted Autoptimize’s cache, and reloaded the page with the error.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    errr … and with below snippet?

    add_filter('autoptimize_filter_imgopt_noptimize','imgopt_excl');
    function imgopt_excl() {
      return '2018/07/IMG_8856-1-1';
    }
    fifteenwheat

    (@fifteenwheat)

    This fixed the problem, but sadly only on that specific page, as far as i can tell :/

    With other products, the problem still exits. For example here

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I can confirm the exclusions currently only work on filename basis (had to check the code to confirm). I’ll add excluding based on the entire img-tag (so including attribute names/ values) to my todo-list and keep you posted.

    In the mean time I can provide you with a code snippet to stop image optimization on /termek/* if you want?

Viewing 15 replies - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.