Wordpress - stop featured images from being cropped?
How do I stop the featured image of my posts from being cropped?
This is the closest code I've found on functions.php:
function thickbox_fields($form_fields, $post){ unset( $form_fields['image-size'] );
$size = 'full';
$css_id = "image-size-{$size}-{$post->ID}";
$html = "<div style='display: none;' class='image-size-item'><input type='radio' name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'checked='checked' /></div>";
//set as image-size field
$form_fields['image-size'] = array(
'label' => '', //leave with no label
'input' => 'html', //input type is html
'html' => $html //the actual html
);
return $form_fields;
Thanks!!
Solutions
You should use following code in function.php:
Syntax: add_image_size( $name, $width, $height, $crop );
Example: add_image_size( 'homepage-thumb', 220, 180, false );
If $crop is set to be "true" then it will be cropped.
Try it and inform me what happened?
Similar questions
Featured Image Isn't showing with cropped, How to show it?
I am trying to show feature image with cropping. My functions.php code is And my index.php code is How can i show my image in post with cropping. thanks.
WordPress Images | How to get the cropped image?
I have the URL of an image (full size). During the upload it already generates a smaller version (I added this in functions). How can I get this cropped version when I have the full size URL? The Image is not in a post so I can't use post-thumbanil(). The image is in a slider on the Homepage.
Retina ready for uploaded images which are cropped
I used the search but couldn't get the right answer for my issue. I developped a theme, which on the portfolio template take the selected featured image of the different portfolio items and crop them to a fixed size (add_image_size) to make them fit to the general grid. Until here no Problem ;) But what if I want to make all custom uploaded images ...
Thumbnail images chopped off but not cropped to exact dimensions
In Media Settings I have Thumbnail sizes set to width and height of 150 and "Crop thumbnail to exact dimensions (normally thumbnails are proportional)" is not checked. Since the checkbox is not checked, shouldn't the entire image be retained (since thumbnails are supposedly proportional)? However, it is not (see below). Why is this?
Customizing WP FlexSlider plugin - changing way slider images are cropped
I've managed to remove the the side (prev/next) panels of the FlexSlider, however now the primary image is distorted. I'm wondering if there is a way to have the featured image cropped true to proportion/scale? I've tried adjusting the size of the slider, but the problem I'm running into is I won't have control over what images are used - square, r...
Woocommerce - How to get product cropped images
I've searched and tried fixing this myself for several hours, however, I cannot find a proper solution. How can I get the product cropped images? I tried with WC_Product::get_gallery_image_ids() and wp_get_attachment_image_src() but the output is only the original image I have set the sizes of the images in Woocommerce -> Products -> Display and ch...