-
AuthorPosts
-
May 7, 2019 at 9:56 am #1098028
Hi Ismael,
this is the requested new topic based on #1097928.
I added the code you sent yesterday and it broke my site. I put in the complete child theme functions.php in the private area below. It was impossible to add to add the concerning snippet
add_filter( 'wp_calculate_image_srcset', 'av_disable_srcset' );
function av_disable_srcset( $sources ) {
return false;
}
via the WP-Backend, so I had to use FTP. After saving the file the site broke.Earlier in march / april someone recommended:
add_filter( ‘avf_modify_thumb_size’, ‘enfold_customization_modify_thumb_size’, 10, 1 );
function enfold_customization_modify_thumb_size( $size ) {
$size[‘shop_catalog’] = array(‘width’=>200, ‘height’=>300);
return $size;
}
but it failed as well.We also tried CSS in the quick css-container of enfold-child:
$avia_config[‘imgSize’][‘shop_catalog’] = array(‘width’=>200, ‘height’=>300);
Failed.I use to regenerate thumbnails each time after editing.
Best regards, Joerg
May 9, 2019 at 7:57 am #1098774Hey brandgeist17,
Thank you for creating another thread.
What is the generated error when you add the code? It doesn’t create an error on our installation. Please copy that code directly from the forum and not from your email.
Best regards,
IsmaelMay 9, 2019 at 9:15 am #1098803Hi Ismael,
please see below in privat area the error by adding the code in the child theme functions.php via WP-Backend. By adding the same via FTP, the code is being accepted, but site and WP-Login brakes, white screen. The code is taken directly from Forum.
Example product thumbnail regenerated: https://test.brandgeister.de/shop/luchs-harzer-kaffee-liqueur/
best regards, joergMay 11, 2019 at 5:37 pm #1099600Hi,
Can you please paste the code in a service like pastebin – this will help us see why the results are wrong.
Best regards,
BasilisMay 12, 2019 at 10:54 am #1099725Hi Basilius,
here you are: https://pastebin.com/sUSVkWmSMay 13, 2019 at 11:15 am #1100010Hi again,
I just had the same issue with another change of code in the functios-php. Seems as if any change to the file lets the site brake. Any idea, why?
best regards, JoergMay 13, 2019 at 3:57 pm #1100136Hi,
Thanks for the update.
Can we access the file server? We would like to edit the file. Please post the WP and FTP details in the private field.
Best regards,
IsmaelMay 13, 2019 at 5:51 pm #1100177please see below
May 14, 2019 at 12:59 pm #1100509Hi!
Thanks for the update.
We found the issue. Looks like woocommerce automatically switch the thumbnail to “woocommerce_thumbnail” instead of the thumbnail set in the template, which is “portfolio_small”. We have added this code in the functions.php file to adjust the size of the default thumbnail in the catalog page.
add_filter( 'woocommerce_get_image_size_thumbnail', function( $size ) { return array( 'width' => 200, 'height' => 300, 'crop' => 0, ); } );
We also created a new product just to confirm if it’s actually working. (see private field)
IMPORTANT: You have to regenerate the thumbnails if you want all of your products to have the new thumbnail size.
Regards,
IsmaelMay 14, 2019 at 3:13 pm #1100590Hi,
glad to hear that you found the reason and a way to repair this issue.
Before implementing this in the Live-Page let me ask you, if it is normal resp. unavoidable that any thumbnail format is being affected by tis hook. The quality of catalogue-, product- and original pic (used for magnifying glass) got worse. Please see private data.
best reagrds,
JoergMay 15, 2019 at 3:49 am #1100789Hey!
Thanks for the update.
The lost of image quality is expected because we are using a much smaller thumbnail. You have to increase the thumbnail size if you want to make the images sharper when resized.
Best regards,
IsmaelMay 20, 2019 at 10:52 am #1102435Hi,
but this defeats the purpose! Only the shop / catalogue thumb should be resized, not every picture, less than ever the product full sized picture.
best regards,
JoergMay 21, 2019 at 3:37 pm #1102878Hi brandgeist17,
Please have a look at this thread if you want to disable image size generation
https://kriesi.at/support/topic/how-to-disable-enfold-creating-media-image-sizes/Best regards,
VictoriaMay 21, 2019 at 6:43 pm #1103016Hi Victoria,
thank you for this info. I am not sure, if this is really similar to my problem. But, as I did not find the ‘shop_catalog’ thumbnail listed in what Enfold is adding to the hole thumbnail portfolio of woocommerce, I searched for it and found it in some woocommerce config.php
For example:
//product thumbnails
$avia_config[‘imgSize’][‘shop_thumbnail’] = array(‘width’=>120, ‘height’=>120);
$avia_config[‘imgSize’][‘shop_catalog’] = array(‘width’=>450, ‘height’=>450);
$avia_config[‘imgSize’][‘shop_single’] = array(‘width’=>450, ‘height’=>999, ‘crop’ => false);To my mind, as a coding amateur, it would be logical to change this size into:
$avia_config[‘imgSize’][‘shop_catalog’] = array(‘width’=>200, ‘height’=>300);How could one achieve this with a child theme?
best regards,
JoergMay 26, 2019 at 9:58 am #1104269Hi,
For easier solution, install a plugin called ” Simple Image Sizes ” and this will short your problems than waste time with code.
Best regards,
BasilisMay 26, 2019 at 12:36 pm #1104291Hi,
you are kidding, are you? One of the reasons for this thread lasting for weeks now is the fact that Simple Image size does not do what it should. Example from firefox inspector below.
Regards, joergMay 28, 2019 at 8:17 am #1104730Hi,
Sorry for the confusion.
Try to add a conditional function to the “woocommerce_get_image_size_thumbnail” filter.
add_filter( 'woocommerce_get_image_size_thumbnail', function( $size ) { if( ! is_singular('product') ) { return array( 'width' => 200, 'height' => 300, 'crop' => 0, ); } return $size; } );
This should only set the width to 200px on catalogue or product archive pages.
Best regards,
IsmaelMay 28, 2019 at 11:42 am #1104777Hi Ismail,
sounds good, but where should I add this? Put in the Child theme functions.php lets the site crash. Please see below.May 30, 2019 at 2:53 pm #1105432Hi,
Thanks for the update.
We added the code in the functions.php file and it seems to be working properly. The size of the product thumbnail in the catalogue page is 200x300px while retaining the actual thumbnail size in the single product pages.
Best regards,
IsmaelJune 14, 2019 at 1:22 pm #1110309Hi Ismael,
sorry, but obviously not. Please see private.
best regards jfJune 24, 2019 at 12:43 am #1112784Hi,
You have to upload the product image again or regenerate the existing thumbnails. The product in the screenshot already exists before we did the modification. Did you check the dummy product that we added?
Thank you for the update.
Best regards,
IsmaelJune 26, 2019 at 2:55 pm #1113619Hi,
I cheked everything again and again. It’s true: the single product thumb now is not affected anymore and the shop thumb is. In this respect, the code seems to work. But not only the shop thumb format is smaller, the picture quality is worse, too. It seems to me if the picture’s width and height is not being scaled only, but same time the resolution is being reduced strongly. Kind of double effect. Maybe EWWW Optimizer interferes or strikes back. I don’t know.
If this effect cannot be avoided, I will leave everything as it is.
regards, joergJuly 1, 2019 at 6:59 am #1114798Hi,
But not only the shop thumb format is smaller, the picture quality is worse
Have you tried adjusting the width and height value inside the filter? That should improve the image quality. It might be actually good to double the size of the images (400x600px), so they still look good on screens with higher dpi, e.g devices with retina displays.
Best regards,
IsmaelJuly 2, 2019 at 5:44 pm #1115251Hi, which of the 3 filter do you mean?
add_filter( ‘wp_calculate_image_srcset’, ‘av_disable_srcset’ );
function av_disable_srcset( $sources ) {
return false;
}add_filter( ‘avf_modify_thumb_size’, ‘enfold_customization_modify_thumb_size’, 10, 1 );
function enfold_customization_modify_thumb_size( $size ) {
$size[‘portfolio_small’] = array(‘width’=>200, ‘height’=>300);
$size[‘shop_catalog’] = array(‘width’=>200, ‘height’=>300);
return $size;
}add_filter( ‘woocommerce_get_image_size_thumbnail’, function( $size ) {
return array(
‘width’ => 200,
‘height’ => 300,
‘crop’ => 0,
);
} );July 4, 2019 at 3:18 pm #1115814Hi,
I mean the filter named “woocommerce_get_image_size_thumbnail” or the last one.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.