Thumbnail Image Cropping?
-
I am building a theme for the company I work for. I am having a little bit of a difficult time getting the custom thumbnail size working properly.
I have set the custom thumbnail size in my functions.php file
add_image_size( 'custom-blog-picture', 617, 999, true ); //617 pixels wide (and unlimited height)
I want the image to be 617px wide (which is the full width of the content container) and 281px high, with the image cropped to those dimensions.
I then call the custom thumbnail size in my theme template file like so:
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('custom-blog-picture'); ?></a>
Note: The height and width of the image I am using is 620px x 388px.
I set the featured image of the post, and refreshed the page and the image gets pulled on to the page with the size of 617px x 388px.
I then tried to set the featured image size to a hard value:
add_image_size( 'custom-blog-picture', 617, 281, true ); //617 pixels wide (and unlimited height)
But the image then was set at a width 446px and a height of 281px. So now it seems like the width dictates what the height is going to be?
But I’ve set the crop mode to be true. So why isn’t the image being cropped at 617×281 and displayed as such??
- The topic ‘Thumbnail Image Cropping?’ is closed to new replies.