• Resolved patjepony

    (@patjepony)


    Previous versions of WordPress cropped the single product page into a 1:1 square. This was ideal for me, as I could hide the image watermark just outside the square. With the new update the crop disappeared and my watermark is visible.

    How do I manage to activate the crop again on the single product page image?

    Thank you!

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi, look at this code…
    I’m using it to apply the ratio/crop settings to “single images” :

    
    /**
     * Apply the ratio/crop settings in <code>Customizer > WooCommerce > Product Images</code> to <code>single</code> images.
     */
    
    add_filter( 'woocommerce_get_image_size_single', 'crop_wc_image_single' );
    
    function crop_wc_image_single( $size ) {
        $cropping = get_option( 'woocommerce_thumbnail_cropping', '1: 1' );
    
    	if ( 'uncropped' === $cropping ) {
    		$size['height'] = 9999999999;
    		$size['crop']   = 0;
    	} elseif ( 'custom' === $cropping ) {
    		$width          = max( 1, get_option( 'woocommerce_thumbnail_cropping_custom_width', '4' ) );
    		$height         = max( 1, get_option( 'woocommerce_thumbnail_cropping_custom_height', '3' ) );
    		$size['height'] = round( ( $size['width'] / $width ) * $height );
    		$size['crop']   = 1;
    	} else {
    		$cropping_split = explode( ':', $cropping );
    		$width          = max( 1, current( $cropping_split ) );
    		$height         = max( 1, end( $cropping_split ) );
    		$size['height'] = round( ( $size['width'] / $width ) * $height );
    		$size['crop']   = 1;
    	}
    	return $size;
    }
    
    Thread Starter patjepony

    (@patjepony)

    You’re a star! That worked! Thank you!

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    The next update, WooCommerce 3.3.1, will help fix this problem.

    You can try out the pre-release here: https://woocommerce.wordpress.com/2018/02/01/woocommerce-3-3-1-status-update/

    JDTravel

    (@jdtravel)

    Hi Caleb,
    I’ve updated to 3.3.1 and there is no option to crop the single product page image.
    In Appearance -> Customize -> Woocommerce -> Product Images
    There are settings to crop the Thumbnails, but for the ‘Main Image’ there is a message saying:
    “Image size used for the main image on single product pages. These images will remain uncropped”
    Can this issue be addressed?
    Thanks

    @seebz

    It works only in customizer mode, not at the front end? How can I use squere images in products detail (single)?

    4 months, no reply from developer. Waow.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Single product page image crop dissapeared’ is closed to new replies.