• Resolved bartelby

    (@bartelby)


    Hello,

    Report Number: QGDURIAD

    I had images measuring 400x600px with the responsive placeholder set in the media settings and ‘Add Missing Sizes’ enabled.
    I’ve changed the images to a new size: 266 x 399 px. The width of the new images is now 266 px, but the height has remained at 600 px. This creates a significant misalignment with the responsive placeholder.
    I’ve cleared the cache. Nothing has changed.
    Thank you for your help.

    • This topic was modified 1 month, 4 weeks ago by bartelby.

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support qtwrk

    (@qtwrk)

    <?php
    require __DIR__ . '/wp-load.php';

    echo '<pre>';
    foreach ( array(
    'woocommerce_thumbnail_image_width',
    'woocommerce_thumbnail_cropping',
    'woocommerce_thumbnail_cropping_custom_width',
    'woocommerce_thumbnail_cropping_custom_height',
    ) as $opt ) {
    echo str_pad( $opt, 46 ) . ': ' . var_export( get_option( $opt ), true ) . "\n";
    }


    if ( function_exists( 'wc_get_image_size' ) ) {
    echo "wc_get_image_size('woocommerce_thumbnail'):\n";
    print_r( wc_get_image_size( 'woocommerce_thumbnail' ) );

    $cat_size = apply_filters( 'subcategory_archive_thumbnail_size', 'woocommerce_thumbnail' );
    echo "\nsubcategory_archive_thumbnail_size => " . var_export( $cat_size, true ) . "\n";
    echo "wc_get_image_size(\$cat_size):\n";
    print_r( wc_get_image_size( $cat_size ) );
    } else {
    echo "no woo\n";
    }
    echo '</pre>';

    please create a file like test.php at same dir as wp-config.php , with above code, then open it in browser, share the output , then delete this file.

    Thread Starter bartelby

    (@bartelby)

    Hello,

    Thank you for your answer.

    I’ve got the following problerm : there’s a waf at the server level put here by the provider => 403 error. There’s nothing I can do to by-pass it. Sorry.

    Thread Starter bartelby

    (@bartelby)

    Hello,

    I’ve managed to disable the firewall.
    Here is the outpu from https://boutique.teinturesauvage.fr/test.php

    ?php require __DIR__ . '/wp-load.php'; echo '
    ';
    foreach ( array(
    'woocommerce_thumbnail_image_width',
    'woocommerce_thumbnail_cropping',
    'woocommerce_thumbnail_cropping_custom_width',
    'woocommerce_thumbnail_cropping_custom_height',
    ) as $opt ) {
    echo str_pad( $opt, 46 ) . ': ' . var_export( get_option( $opt ), true ) . "\n";
    }


    if ( function_exists( 'wc_get_image_size' ) ) {
    echo "wc_get_image_size('woocommerce_thumbnail'):\n";
    print_r( wc_get_image_size( 'woocommerce_thumbnail' ) );

    $cat_size = apply_filters( 'subcategory_archive_thumbnail_size', 'woocommerce_thumbnail' );
    echo "\nsubcategory_archive_thumbnail_size => " . var_export( $cat_size, true ) . "\n";
    echo "wc_get_image_size(\$cat_size):\n";
    print_r( wc_get_image_size( $cat_size ) );
    } else {
    echo "no woo\n";
    }
    echo '
    ';

    Thank you

    Plugin Support litetim

    (@litetim)

    @bartelby hello
    the output is not the expected one.
    Please make sure:
    – you copied the correct content(all the < and >)
    – and the file has permission to execute

    Also the script has code 403 now(forbidden)

    • This reply was modified 1 month, 3 weeks ago by litetim.
    Thread Starter bartelby

    (@bartelby)

    Hello,

    Thank you. Yes I’ve missed the <. Sorry.

    Here is the result

    woocommerce_thumbnail_image_width             : '400'
    woocommerce_thumbnail_cropping : 'uncropped'
    woocommerce_thumbnail_cropping_custom_width : '2'
    woocommerce_thumbnail_cropping_custom_height : false
    wc_get_image_size('woocommerce_thumbnail'):
    Array
    (
    [width] => 400
    [height] =>
    [crop] => 0
    )

    subcategory_archive_thumbnail_size => 'woocommerce_thumbnail'
    wc_get_image_size($cat_size):
    Array
    (
    [width] => 400
    [height] =>
    [crop] => 0
    )

    Thank you for your help

    Plugin Support qtwrk

    (@qtwrk)

        [width] => 400
    [height] =>
    [crop] => 0

    I think this is the issue

    you have 266 x 399 on the image itself , while WP/WC still have width = 400 in setting , then as your real image aspect ratio , 399/266 = 1.5 , the feature add missing size try to retain the aspect , which means 400 x 1.5 = 600 , and so you have 400 x 600

    possible solutions

    1. disable add missing size feature, or
    2. properly configure the WP/WC image setting to respective width as 266 and regenerate all images with new thumbnail sizes.
    Thread Starter bartelby

    (@bartelby)

    Thank you very much.

    Solution 1 is the easiest and works.

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

You must be logged in to reply to this topic.