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

    (@jeherve)

    Jetpack Mechanic ??

    Jetpack actually automatically detects which image size to use in the Carousel view based on your device and its viewport. Depending on the width of your browser, Carousel may use the original, large, or medium file size.

    You can find out more by looking at the code here:
    https://github.com/Automattic/jetpack/blob/2.7/modules/carousel/jetpack-carousel.js#L877

    Thread Starter NickyDigital

    (@nickydigital)

    Thanks for your response Jeremy!

    My site utilizes watermarks on all images except the original image.

    https://nickydigital.staging.wpengine.com/

    We need to be able to limit the images that carousel grabs so it never displays the unwatermarked images.

    Is that possible?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    You should be able to use the jp_carousel_add_data_to_images filter (ref) to change the HTML used to build the Carousel view, and use a large version of the file instead of the original file, for example.

    Here is how I would do it (note that I haven’t tested this code, though):

    function jeherve_no_orig_image_carousel( $html, $attachment_id ) {
    
    	$smaller_img = wp_get_attachment_image_src( $attachment_id, 'large' );
    
    	$html = preg_replace(
    		'/data-orig-file="\{.*?\}"/',
    		'data-orig-file="'. esc_attr( $smaller_img ) .'"',
    		$html
    	);
    
    	return $html;
    }
    add_filter( 'jp_carousel_add_data_to_images', 'jeherve_no_orig_image_carousel', 10, 2 );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Jetpack Carousel’ is closed to new replies.