我正在使用Aqua resizer 调整循环中缩略图的大小。比使用WordPress的缩略图更灵活。问题是,Aqua Resizer的图像结果没有宽度和高度像素。缺少宽度和/或高度属性。这将降低负载速度,如GTmetrix所示。
下面是我调用循环中图像的代码:
 <?php $thumb = get_post_thumbnail_id(); 
    $img_url = wp_get_attachment_url( $thumb,\'full\' ); 
    $image = aq_resize( $img_url, 150, 200, true, true, true ); 
 ?>
 <img src="<?php if($image) { echo esc_url($image);
 } else {
 echo catch_that_image();} ?>" alt="<?php  echo get_bloginfo(\'name\'); ?>"/>
 非常感谢你的帮助。
非常感谢。
 
                    最合适的回答,由SO网友:Trevor Anderson 整理而成
                    那么,像马克所说的那样添加属性有什么错呢?
<?php $thumb = get_post_thumbnail_id(); 
   $img_url = wp_get_attachment_url( $thumb,\'full\' ); 
   $image = aq_resize( $img_url, 150, 200, true, true, true ); 
?>
<img src="<?php if($image) { echo esc_url($image);
} else {
echo catch_that_image();} ?>" width="150" height="200" alt="<?php  echo get_bloginfo(\'name\'); ?>"/>