• Resolved aaron843

    (@aaron843)


    I have been trying to implement this code: https://jetpack.com/2013/05/03/skip-a-image-with-photon/

    But have not been having much luck.

    I have tried setting jetpack_photon_skip_image to always be true, and Photon still caches and serves all images.

    Example:

    function no_photon_by_page() {
      if ( true ) {
        add_filter( 'jetpack_photon_skip_image', '__return_true');
      }
    }
     
    add_action('wp', 'no_photon_by_page');

    I am trying to figure out why jetpack_photon_skip_image is not working on my site.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    The filter appears to work well on my end, when used to exclude specific images.

    For example if the directory contains ‘abc’, ‘asd’ or ‘xyz’ I would want to exclude it from Photon, but include all others.

    Something like this works in my tests:

    function jeherve_skip_photon( $val, $src, $tag ) {
            if ( stripos( $src, 'abc' ) ) {
                    return true;
            }
    
            return $val;
    }
    add_filter( 'jetpack_photon_skip_image', 'jeherve_skip_photon', 10, 3 );

    If that doesn’t seem to work on your end, could you post a link to a page where you have the issue, as well as the code you used to try to exclude the image?

    Thanks!

    Thread Starter aaron843

    (@aaron843)

    function jeherve_skip_photon( $val, $src, $tag ) {
            if ( stripos( $src, '2015' ) ) {
                    return true;
            }
    
            return $val;
    }
    add_filter( 'jetpack_photon_skip_image', 'jeherve_skip_photon', 10, 3 );
    

    Is there a way to send the link to you privately?

    • This reply was modified 9 years, 1 month ago by aaron843.
    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    You can send us more details via this contact form:
    http://jetpack.com/contact-support/

    Thread Starter aaron843

    (@aaron843)

    Sent.

    Let me also add the following observations:

    jetpack_photon_skip_image does seem to be working correctly with regard to src inside the img tag. However, all sizes of the image are still being copied to the wordpress servers and being made publicly available (for example, the URL in data-large-file); this is the activity I would like to stop.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    However, all sizes of the image are still being copied to the wordpress servers and being made publicly available (for example, the URL in data-large-file); this is the activity I would like to stop.

    We’ll take a look at the example you sent us via email, and we’ll help you figure this out!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘jetpack_photon_skip_image not working’ is closed to new replies.