woocommerce_image_sizes_to_resize

woocommerce_image_sizes_to_resize

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.7.1

apply_filters('woocommerce_image_sizes_to_resize') is found 2 times:

  • /includes/class-wc-regenerate-images.php line 71
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    * @param string $size Size name.
     * @return array
     */
    public static function filter_image_get_intermediate_size( $data, $attachment_id, $size ) {
        if ( ! is_string( $size ) || ! in_array( $size, apply_filters( 'woocommerce_image_sizes_to_resize', array( 'woocommerce_thumbnail', 'woocommerce_gallery_thumbnail', 'woocommerce_single' ) ), true ) ) {
            return $data;
        }
     
        // If we don't have sizes, we cannot proceed.
        if ( ! isset( $data['width'], $data['height'] ) ) {
            return $data;
  • /includes/class-wc-regenerate-images.php line 207
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
        return $image;
    }
     
    // List of sizes we want to resize. Ignore others.
    if ( ! $image || ! in_array( $size, apply_filters( 'woocommerce_image_sizes_to_resize', array( 'woocommerce_thumbnail', 'woocommerce_gallery_thumbnail', 'woocommerce_single' ) ), true ) ) {
        return $image;
    }
     
    $target_size      = wc_get_image_size( $size );
    $image_width      = $image[1];
    $image_height     = $image[2];