我怎么能改变宽度和高度从抓取在wordpress帖子图像


how can i change the width and height from fetching post images in wordpress?

我在一个循环中获取帖子图像,每个图像都会显示新的宽度和高度。我有问题,我应该如何定义宽度和高度在img标签。

<?php
 $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID() ),
         'single-post-thumbnail'); 
?>
<img src="<?= $image[0]; ?>" alt="" width="" height="" />

array getimagesize (string $filename [, array &$imageinfo])

从http://php.net/manual/en/function.getimagesize.php

Also, from http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src

<?php 
    $attachment_id = 8; // attachment ID
    $image_attributes = wp_get_attachment_image_src( $attachment_id ); // returns an array
?> 
<img src="<?php echo $image_attributes[0]; ?>" width="<?php echo $image_attributes[1]; ?>" height="<?php echo $image_attributes[2]; ?>">