I’m trying to display wide image icons from the_post_thumbnail() function. I’m using ‘true’ value for cropping, but they are not cropped well… I get some strange results with different sizes (I’m trying to use 200width x 150height). If image cannot be display with good proportions (I don’t know why whem I’m cropping it? ) then I want it to have exact 150px height always! How can I achieve it? I’ve been trying with set_post_thumbnail_size() but its even worst…
Leave a Reply
You must be logged in to post a comment.
If the critical dimension is height, you have a couple options:
Hard-cropping to the exact width/height:
The hard-crop will create a thumbnail size using the exact dimensions. Be sure that all images have a minimum width/height as what is defined.
Or soft-cropping (i.e. “box-resizing”) constrained to height:
The soft-crop with an unconstrained dimension (i.e.
9999
width) will box-resize to the exact height, while allowing the width to be, essentially, anything. Be sure that all images have a minimum height as what is defined.Also: make sure that, if you have added these
add_image_size()
functions after already uploading/attaching some images, that you regenerate your thumbnails.