现在的代码如下(现在可以调用ubb代码【img】的远程图片作为文章缩略图,第一个if是判断如果存在本地附件图片就先调用本地图片):
<?php $fox=0;
if ($val['attachs']) {
$fox=1;?>
<div class="aw-article-text col-md-4">
<?php $attach=array_rand($val['attachs'],1);?>
<img class="img-polaroid kltu" src="<?php echo $val['attachs'][$attach]['attachment']; ?>" alt="<?php echo $attach['file_name']; ?>" />
</div>
<?php }else{
$body=$val['message'];
$img_array = array();
preg_match_all("/\[img\](.*?)\[\/img\]/i",$body,$img_array);
$img_array = array_unique($img_array[1]);
if(count($img_array)>0){
$fox=1;
foreach($img_array AS $key => $attach) {
if($key==0){?>
<div class="aw-article-text col-md-4">
<img class="img-polaroid kltu" src="<?php echo $attach; ?>" alt="<?php echo $val['title']; ?>" />
</div>
<?php }}}}?>
请问如何在这个基础上,增加一个就是html代码的图片也能调用为缩略图,如<img src="">这样代码的,
需要怎么写?
把你的问题再描述清楚一点吧