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.
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.
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
@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.
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
- disable add missing size feature, or
- properly configure the WP/WC image setting to respective width as 266 and regenerate all images with new thumbnail sizes.
Thank you very much.
Solution 1 is the easiest and works.