wordpress日志中的全部图片以缩略图的形式显示在文章摘要底部

在index.php中添加如下代码,可以达到的效果是,日志中所有图片都以你规定的尺寸显示出来了,横向排列
$szPostContent = $post->post_content;
$szSearchPattern = '~]*/ />~'; // 搜索所有符合的图片
preg_match_all( $szSearchPattern, $szPostContent, $aPics );
$iNumberOfPics = count($aPics[0]); // 检查一下至少有一张图片
if ( $iNumberOfPics > 0 ) {
// 这里是你怎么处理图片的内容
?>










};
?>

 
规定的尺寸在style.css中写
 
#new {
text-align:left;
margin-bottom:13px;
width:75px; }
#new img{
     width: expression(this.width > 75? 75: true); max-width: 75px;
height: expression(this.height > 75? 75: true); max-height: 75px;
}
 

你可能感兴趣的:(WordPress资料库)