WordPress: Get attached image height and width
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.
You can also do something like this:
$image_attributes = wp_get_attachment_image_src( $attachment_id = 8 );
if ( $image_attributes ) : ?>
<img src="<?php echo $image_attributes[0]; ?>" width="<?php echo $image_attributes[1]; ?>" height="<?php echo $image_attributes[2]; ?>" />
<?php endif; ?>