WordPress.org

Support

Support » How-To and Troubleshooting » problem with the_post_thumbnail pics scaled not cropped

problem with the_post_thumbnail pics scaled not cropped

  • Hey all,

    lately I wanted to upgrade ym 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 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, as desired. 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. None of this solved the problem.

    Any ideas greatly appreciated.

  • The topic ‘problem with the_post_thumbnail pics scaled not cropped’ is closed to new replies.
Skip to toolbar