Tagged: function.php, thumbnail sizes
-
AuthorPosts
-
October 14, 2020 at 3:49 pm #1252796
I am buidling websites for photographers, so with a lot of uploaded photos/ Mostly these photos are all 1:1 or 2:3 ratios.
Building such a website with Enfold results in a lot of unnecessary files in the form of unnecessary thumbnail dimensions, adding a lot of extra size in MB’s or even GB’s to a website. Not very good for making backups or using shared hosrting with restrictions.
I have read some more topics about this issue here on the Enfold forum and I know now that Enfold is creating 12 extra thumbnail sizes, next to the 3 default WordPress thumbnail sizes and next to the original uploaded image. A total of 16 files for just one image..!
Looking in the functions.php file I noticed these specific Enfold thumbnail sizes:
$avia_config[‘imgSize’][‘widget’] = array(‘width’=>36, ‘height’=>36); // small preview pics eg sidebar news
$avia_config[‘imgSize’][‘square’] = array(‘width’=>180, ‘height’=>180); // small image for blogs
$avia_config[‘imgSize’][‘featured’] = array(‘width’=>1500, ‘height’=>430 ); // images for fullsize pages and fullsize slider
$avia_config[‘imgSize’][‘featured_large’] = array(‘width’=>1500, ‘height’=>630 ); // images for fullsize pages and fullsize slider
$avia_config[‘imgSize’][‘extra_large’] = array(‘width’=>1500, ‘height’=>1500 , ‘crop’ => false); // images for fullscrren slider
$avia_config[‘imgSize’][‘portfolio’] = array(‘width’=>495, ‘height’=>400 ); // images for portfolio entries (2,3 column)
$avia_config[‘imgSize’][‘portfolio_small’] = array(‘width’=>260, ‘height’=>185 ); // images for portfolio 4 columns
$avia_config[‘imgSize’][‘gallery’] = array(‘width’=>845, ‘height’=>684 ); // images for portfolio entries (2,3 column)
$avia_config[‘imgSize’][‘magazine’] = array(‘width’=>710, ‘height’=>375 ); // images for magazines
$avia_config[‘imgSize’][‘masonry’] = array(‘width’=>705, ‘height’=>705 , ‘crop’ => false); // images for fullscreen masonry
$avia_config[‘imgSize’][‘entry_with_sidebar’] = array(‘width’=>845, ‘height’=>321); // big images for blog and page entries
$avia_config[‘imgSize’][‘entry_without_sidebar’]= array(‘width’=>1210, ‘height’=>423 ); // images for fullsize pages and fullsize sliderFrom this list I want to exclude all of them except 180×180, 36×36 and 768×512.
If I understand things correctly from the other topics about this subject, then I can add some code to my functions.php file (in my child theme of course) to exclude these thumbnails from being created when I upload new images in the future. After adding the code I have to use a plugin to generate my thumbnails again.
Is that the correct workflow? And of course, what code do I have to ad in functions.php?
Thanks very much :)
Alwin
October 18, 2020 at 6:09 pm #1253640Hey Alwin,
Please have a look at the following thread:
If you need further assistance please let us know.
Best regards,
VictoriaOctober 19, 2020 at 12:59 pm #1253946I already read that topic, and others, but still don’t know how to proceed.
– I want to delete all the thumbnails sizes I don’t use
– I prefer not to use a plugin for that but add code to my functions.php file so I can store that file in my child theme
(Because i don’t qnt the thumbnails to be added again when there is a Enfold theme update)So do I have to add this code to my functions.php?
function ava_image_sizes() {
remove_image_size(‘masonry’);
remove_image_size(‘magazine’);
remove_image_size(‘widget’);
remove_image_size(‘featured’);
remove_image_size(‘featured_large’);
remove_image_size(‘extra_large’);
remove_image_size(‘portfolio_small’);
remove_image_size(‘gallery’);
remove_image_size(‘entry_with_sidebar’);
remove_image_size(‘entry_without_sidebar’);
}
add_action( ‘after_setup_theme’, ‘ava_image_sizes’, 11 );And if my functions.php is in my child theme, then these thumbnail sizes will not be created again after an Enfold theme update?
Last step is to use a plugin (just once) to remove the unwanted thumbnails that are already created yet?October 19, 2020 at 3:36 pm #1254011Hi Alwin,
Well, you can delete them manually, add the code to the functions.php in the child theme, and then all newly uploaded images will not get those thumbs.
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.