I'm re-styling my site from a regular list format to a magazine style, and I've been trying for several hours to get square, scaled down thumbnails. I can't for the life of me make it work.
My site: http://clarebayley.com (forgive the current ugliness, I pulled it out of maintenance mode for this)
Things I've tried:
1. Use WP 3's cropped thumbnail feature.
I have gd installed, and add_theme_support( 'post-thumbnails' ); in functions.php. In Settings->Media, I set width/height to 150 and checked the crop box. I also tried using add_image_size and set_post_thumbnail_size in functions.php.
NONE of this works. I regenerated all my thumbnails using the Regenerate Thumbnails plugin after every change, but it still merely re-sizes them proportionally. :(
2. Use a non-cropped thumbnail as the background of a square div
I re-scaled all my thumbnails to 400x400, and then tried to set them as the bg of a 150x150 box in the hopes this would give me a pseudo crop of the image.
I tried Frumph's advice from this thread:
http://wordpress.org/support/topic/post-thumbnail-as-background?replies=12
<?php if ( has_post_thumbnail() ) { /* loads the post's featured thumbnail, requires WordPress 3.0+ */
$post_image_id = get_post_thumbnail_id( the_ID() );
if ($post_image_id) {
$thumbnail = wp_get_attachment_image_src( $post_image_id, 'thumbsquare', false);
echo '<div class="featured-thumbnail" style="background: url(';
echo $thumbnail[0];
echo ');">';
echo ' ';
echo '</div>';
This (which is currently active on the site) works, but uses the full size image so I only get a tiny corner of the image in the square.
I'm fine with only having a quarter of the image or so in the box, but not 1/100th of the image.
I'm flumoxed. Any help would be majorly appreciated.