0

I am trying my hands with WP add_image_size method and this is the entry in my theme's function.php

if ( function_exists( 'add_theme_support' ) ) {
 add_theme_support( 'post-thumbnails' );
 set_post_thumbnail_size( 100, 65); // default Post Thumbnail dimensions   
}

if ( function_exists( 'add_image_size' ) ) { 
 add_image_size( 'home_page_featured', 200, 225, true);
}

I tried with both parameters of crop factor but seems nothing is working for me. I am uploading Dimensions 628x355 and want that beside all OOB image size, home_page_featured should be get created with dimensions 200x225, but WP is generating it as 200x113

i tried with Regenerate Thumbnails plugin but seems like it is not working, not sure where i am doing wrong.

  • add_image_size('home_page_featured',200,225,true); works ok for me, WP 3.5 and TwentyTwelve: uploading a 628x355 image generates a 200x225 thumbnail. Check if debugging outputs information and do a full troubleshooting. – brasofilo Jan 13 '13 at 13:33
  • @brasofilo: this is some weired behaviour for me, will check log info – Umesh Awasthi Jan 13 '13 at 14:31
1

The code bellow should work properly. Also read this post WordPress Featured Images – add_image_size() resizing and cropping demo.

Add this code in the file functions.php:
add_image_size( 'Home Page Featured'', 200, 225, true );

And call it like this in home page the_post_thumbnail('Home Page Featured');

| improve this answer | |
  • but you have to reupload images otherwise try { wordpress.org/extend/plugins/ajax-thumbnail-rebuild - This plugin allows you to re-build the post thumbnails. Useful if you use add_image_size() after already having uploaded post thumbnails. (This plugin is slow, but never has out of memory errors). } – Muhammad Furqan Jan 13 '13 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.