Is there a tag for the medium and thumbnail images of the original full size uploaded image?
You know how WP creates 2 new images of different sizes than the full size image that is uploaded...
1. image.jpg
2. image-300x300.jpg (medium) - this is a newly created image
3. image-150x150.jpg (thumbnail) - this is a newly created image
the dimensions may change, so i was wondering if there is a tag that will display the 'medium' or the 'thumbnail' version of each image
What exactly do you mean by "tag"?
The wp_get_attachment_image() function can get any attachment image by ID, if you know the attachment ID. It takes a second parameter of "medium", "thumbnail", "full", "large", etc.
that could be it... i want to get/display the thumbnail version of the "image.jpg" i have uploaded
So what am I doing wrong to get the medium image to display?
function postimagebg($size=medium) {
if ( $images = get_children(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => 1,
'post_mime_type' => 'image')))
{
foreach( $images as $image ) {
$attachmenturl=wp_get_attachment_thumb_url($image->ID, medium );
$attachmentimage=wp_get_attachment_image( $image->ID, $size );
echo ''.$attachmenturl.'';
}
} else {
bloginfo('template_url');
echo '/images/no_image.jpg';
}
}