This support forum is no longer in use. Please use the Cloudinary Community at https://community.cloudinary.com/ to receive assistance from other members of the community and from Cloudinary's support team. For account-specific questions or if you believe that you've encountered a bug, please contact the Cloudinary team directly via the "submit a request" option on this support site.

G_AUTO automatically added - TURN OFF

Comments

1 comment

  • Avatar
    Loic Verger Del Bove

    Hi Nemanja,

    Thanks for reaching out.

    This is automatic when adding width and height to your image element. You can modify it by adding this piece of code to your functions.php

    /**
    * Granular control on Cloudinary crops.
    *
    * @param array|string $size The size array or slug.
    * @param int $attachment_id The attachment ID.
    *
    * @return array|string
    */
    add_filter(
    'cloudinary_prepare_size',
    function ( $size, $attachment_id ) {
    if (
    is_array( $size ) &&
    (
    // Check more about WordPress conditionals here https://developer.wordpress.org/themes/basics/conditional-tags/.
    is_post_type_archive( 'product' ) ||
    // Check more specific WooCommerce conditionals here https://docs.woocommerce.com/document/conditional-tags/.
    is_woocommerce() ||
    // Check specific requested image sizes.
    'woocommerce_thumbnail' === $size['wpsize']
    )
    ) {
    $size['crop'] = 'scale';
    unset( $size['gravity'] );
    }

    return $size;
    },
    10,
    2
    );

    This code is for WooCommerce, so you might need to add a condition depending on how your images are added

    Hope that helps.

    Best,

    Loic

    0
    Comment actions Permalink

Post is closed for comments.