• Resolved catnhat

    (@catnhat)


    I have thumbnails setup to 85×85 cropped.
    I have rebuilt thumbnails with 2 different plugins with the same result.

    The thumbnail images are properly changed and cropped to 85×85.

    However when I use <?php the_post_thumbnail('thumbnail'); ?>
    it returns results in the 85×85 image being stretched to 85×57 or 56×85.

    In short, the thumbnails are being created properly but displayed as if they are not cropped.

    Any ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try adding:

    set_post_thumbnail_size( 85, 85, true );

    to your theme’s function.php file

    Thread Starter catnhat

    (@catnhat)

    I am already using this with other dimensions for other purposes.

    so I tried adding my own with add_image_size('squareThumb', 85, 85, true);

    It did the same thing as thumbnails.

    Thread Starter catnhat

    (@catnhat)

    Am I the only one with this issue?

    Thread Starter catnhat

    (@catnhat)

    I ended up creating a function in my child theme to take car of this. and then called the function instead of using the post thumbnail function.

    the code for the function looks like this:

    <?php
    function fc_rel_thumb($postid=0, $size='squareThumb', $attributes='') {
    	if ($postid<1) $postid = get_the_ID();
    	if ($images = get_children(array(
    		'post_parent' => $postid,
    		'post_type' => 'attachment',
    		'numberposts' => 1,
    		'post_mime_type' => 'image', )))
    		foreach($images as $image) {
    			$thumbnail=wp_get_attachment_image_src($image->ID, $size);
    			?>
    <img src="<?php echo $thumbnail[0]; ?>" <?php echo $attributes; ?> />
    <?php
    		}
    	else {
    		echo '<img src=' . get_bloginfo ( 'stylesheet_directory' );
    		echo '/images/no-attachment.gif>';
    	}
    
    }
    add_image_size('squareThumb', 85, 85, true);
    ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘the_post_thumbnail returning wrong size images’ is closed to new replies.