![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
-
AuthorPosts
-
May 5, 2023 at 5:09 am #1406502
How can we force all featured images throughout the theme to use 16:9 or 1.91:1 instead of the wonky ratio it uses now?
May 5, 2023 at 11:21 am #1406517if your nick belongs to your page – i think i know what you like to go for.
Enfold uses different sources for the images on different elements. For example on a single post it uses the entry_with_sidebar size!
This is a ratio at : 2.6
the magazine ratio is nearby: 1.89 – so try this one if it is ok for you
On a blog in grid view – it uses the portfolio image size. – But you can change that by child-theme functions.php snippet:try:
add_filter("avf_post_slider_args", function($atts, $context) { if( $context == "archive" ) { $atts['type'] = 'grid'; $atts['columns'] = 3; $atts['preview_mode'] = 'custom'; $atts['image_size'] = 'magazine'; } return $atts; }, 10, 2);
_______
now : if it has to be that 16:9 aspect-ratio:
you can either redefine the entry_with_sidebar size to that ratio or set your own image-size in that ratio.
Both solutions need a recalculation of your thumbnails.May 5, 2023 at 12:08 pm #1406521The newly added size with 16:9 f.e.
add_image_size( 'new-blog-size', 495, 260, true ); function my_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'new-blog-size' => __( 'Blog Imagesize' ), ) ); } add_filter( 'image_size_names_choose', 'my_custom_sizes' );
if you like to use that new image-size in the code snippet above – you had to recalculate the thumbnails.
There are plugins for that f.e.: force regenerate thumbnailsMay 5, 2023 at 2:57 pm #1406533Your answer is very confusing. I’m not looking to “resize” images. The 16:9 and the 1.91:1 images are already in my gallery. I’m looking to standardize the image “slot” in the template, and the code not try to force an oddball image size on the website.
May 5, 2023 at 3:55 pm #1406538the point is that even if the images are within your media gallery, they will not be used on the blog or single page. Images recalculated by Enfold are used there. Thats what i wrote above. Only if you are using the portfolio element or blog element on a page there is on the second tab of the element editor the option to choose the image used ( that is the custom setting ) – and on that custom setting you can have original image. But is it advisable to use original sizes of the images in a 3 or 4 grid display where the image widths can hardly exceed 300px? 20 or more featured images on a page with 900px ( and more ) – what would that do to performance?
And on blog and archive pages ( category pages) these options are not available.
In the blog it is by default : portfolio (‘width’ => 495, ‘height’ => 400)
In the single post, depending on whether with sidebar or without :
entry_without_sidebar ( ‘width’ => 1210, ‘height’ => 423 ) or entry_with_sidebar ( ‘width’ => 845, ‘height’ => 321 ) are used.The second solution above not to take the nearby aspect ratio of magazine is to have your own image size registered – but then a recalculation of the thumbnails has to be done.
-
AuthorPosts
- You must be logged in to reply to this topic.