In WordPress, I am grabbing attached images from a post and displaying them in an unordered list. It works great, except I need to now get the image height and width, in the same way that I got the src. This is my code:
PHP
$post_thumbnail_id = get_post_thumbnail_id( $iPostID );
foreach( $arrKeys as $key) {
if( $key == $post_thumbnail_id )
continue;
$sImageUrl = wp_get_attachment_url($key);
$sImgString = '<li><img src="' . $sImageUrl . '" alt="Thumbnail Image" /></li>';
echo $sImgString;
}
Any idea how I can do this?
You can use
wp_get_attachment_image_src($attachment_id), it should return an array like('/path/to/img.jpg',32,64)where 32 is the width and 64 is the height… Read the wordpress codex for more information on the usage of this function.