I'm confused, because there are a lots of functions about attachments . I've tried a lots of functions. I'm setting a featured image for my every blog post.
I have to get different sizes of this image. FOr example a need this variations of featured image
(Images can be cropped).
I'm adding these new image sizes (in
add_image_size('custombig', 600, 400, TRUE); add_image_size('customsmall', 300, 152, TRUE); add_image_size('customimage', 64, 64, TRUE);
<?php // inside a Loop if (has_post_thumbnail( $post->ID )) $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'customsmall' ); ?> <img alt="" src="<?php echo $image; ?>" />
But it's printing full size of image. Not cropping or resizing it.
Can you teach me getting different sizes of attached images, or suggest me a few articles about this ?