Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hi can anyone tell me a good way to use a custom image size with a custom field image in a template without using something like timthumb/phpthumb.

I've set an image size with...

add_action( 'after_setup_theme', 'theme_setup' );
function theme_setup() {
add_image_size( 'theme-custom-size', 329, 118, true );
}

which is fine for the featured image, I just call

the_post_thumbnail( 'theme-custom-size' );

but could I apply this size to an image grabbed with get_post_meta from a custom field image.

Thanks!

EDIT:_

ok, I think a simple way to do it would be to use this plugin http://wordpress.org/extend/plugins/multiple-post-thumbnails/ and use multiple featured images rather than custom fields.

share|improve this question

migrated from stackoverflow.com Jul 1 '11 at 14:22

This question came from our site for professional and enthusiast programmers.

    
Yes, I was just about to suggest Multiple Post Thumbnails. It should do what you want with the minimum of effort. –  Matt Gibson Jul 1 '11 at 13:17

1 Answer 1

when you get image form post_meta, you get the path to the image, then you get do something like :

<img src="<?php echo get_post_meta(ID,'customr field name',true); ?>" 
        width=200 height=200 />
share|improve this answer
    
thanks, but I'd rather do the resize server side to prevent a lot of large images from being downloaded, also this method does not crop the images. –  tom Jul 1 '11 at 10:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.