Lately I wanted to upgrade my blog with featured images/post thumbnails. I’m using a custom theme build on the roots theme (this is not a roots theme issue, I believe). The image I upload is 1024×768 and shall be cropped to letterbox format 1024×512.
This is the code I’m using in the theme-file:
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail(array(1024, 512), array('class' => 'img-responsive')); // add post thumbnail
}
?>
Now, the problem is, that on my local XAMPP box it works perfectly well. But on the webserver images aren’t cropped and, they do not span the entire width of the primary content area, as they do on the local install. Checking the code with Firebug, the image is 682px wide and 512px tall (1024 x 512px on the XAMPP box). So what happens is that the image is scaled, not cropped.
I re-uploaded the theme and I disabled all plugins. And of course I searched related topics, tried other code samples, checked that GD is enabled – it is and regenerated thumbs. None of this solved the problem.
Any ideas greatly appreciated.