I am trying to add a thumbnail crop to images, however I can’t get it to work correctly. I have faced similar problems earlier, but wasn’t able to solve it.
The page shows the latest posts, and since some of them has different horatio and size, I must use thumbnail crop within functions to make them appear the same size and correct horatio, and not scale them into something different.
This is the code I am using to show latest thumb
<?php if ( has_post_thumbnail() ) { the_post_thumbnail('frontpage_thumb'); } ?>
Within functions.php:
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
add_theme_support( 'nav-menus' );
}
add_action( 'after_setup_theme', 'mytheme_custom_thumbnail_size' );
function mytheme_custom_thumbnail_size(){
add_image_size( 'frontpage_thumb', 300, 220, array( 'center', 'center' ) ); // Hard crop center
}
The problem
They thumbs resize, but don’t crop. See page.
I have tried Regenerate Thumb Plugin, but no result.
Have I misunderstood the “WP cropping”?
The problem appeared to be related with the thumbnails with WordPress.
To solve the problem I did the following: