Tagged: featured image, srcset, thumbnail
-
AuthorPosts
-
July 4, 2018 at 12:25 pm #981125
Situation:
All the images I use for the the Featured Image have a default size of 865 × 280.Today I uploaded a Featured Image with the same size, but it is rendered 305×211.
All the other featured images are rendered 355×115
Also the other featured images are showed in a more advance srcsethttps://greywise.redfactory.nl/cases/
Has this something to do with a configuration or a theme update?
- This topic was modified 6 years, 4 months ago by tijshensen.
July 6, 2018 at 11:25 am #981985Hey tijshensen,
Thank you for using Enfold.
This filter should alter the default sizes attribute based on the current thumbnail.
/** * Set sizes atribute for responsive images and better performance * @param array $attr markup attributes * @param object $attachment WP_Post image attachment post * @param string|array $size named image size or array * @return array markup attributes */ function avf_responsive_img_sizes( $attr, $attachment, $size ) { if ( is_array( $size ) ) { $attr['sizes'] = $size[0] . 'px'; } elseif ( $size == 'widget') { $attr['sizes'] = '36px'; } elseif ( $size == 'square') { $attr['sizes'] = '180px'; } elseif ( $size == 'featured') { $attr['sizes'] = '1500px'; } elseif ( $size == 'featured_large') { $attr['sizes'] = '1500px'; } elseif ( $size == 'extra_large' ) { $attr['sizes'] = '1500px'; } elseif ( $size == 'portfolio' ) { $attr['sizes'] = '495px'; } elseif ( $size == 'portfolio_small' ) { $attr['sizes'] = '260px'; } elseif ( $size == 'gallery' ) { $attr['sizes'] = '845px'; } elseif ( $size == 'magazine' ) { $attr['sizes'] = '710px'; } elseif ( $size == 'masonry' ) { $attr['sizes'] = '705px'; } elseif ( $size == 'entry_with_sidebar' ) { $attr['sizes'] = '845px'; } elseif ( $size == 'entry_without_sidebar' ) { $attr['sizes'] = '1210px'; } return $attr; } add_filter( 'wp_get_attachment_image_attributes', 'avf_responsive_img_sizes', 30, 3 );
Let us know if it helps.
Best regards,
IsmaelJuly 9, 2018 at 2:58 pm #983119The ‘portfolio’ size seams correct.
But in the original thumbnails it’s scaled back to 495px X 160px. Where the new thumbnails are cropped 495px X 280px.So when/where does the cropping takes place and how can I avoid cropping?
July 11, 2018 at 2:27 am #983951Hi,
Thanks for the update.
Where can I see the issue again? The thumbnails’ size are 355x116px when I checked the page.
So when/where does the cropping takes place and how can I avoid cropping?
The cropping takes place as soon as the images are uploaded. There’s also a function or script that automatically selects the appropriate size or thumbnail based on the current screen size or resolution which is why we added the filter above.
// https://make.wordpress.org/core/2015/11/10/responsive-images-in-wordpress-4-4/
Best regards,
IsmaelJuly 13, 2018 at 12:31 pm #985133Thanks for your reply.
We decided to create a new overview pages. I think part of the problem lies in the fact that the previous ‘portfolio’ images where cropped in another way then the Enfold theme does.July 16, 2018 at 3:29 am #985810 -
AuthorPosts
- The topic ‘Featured image with the same dimension shows different thumb in blog overview’ is closed to new replies.