1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
function zbp_thumbnail($id,$sltww, $slthh,$link) {
global $zbp,$article;
$article=GetPost((int)$id);
$random = mt_rand(1, 10);
preg_match_all('/<img.*?(?: |\\t|\\r|\\n)?src=[\'"]?(.+?)[\'"]?(?:(?: |\\t|\\r|\\n)+.*?)?\/>/sim', $article->Content, $strResult, PREG_PATTERN_ORDER);
$n = count($strResult[1]);
$zdsuoluetu=$article->Metas->Blogs_suoluetu;
if(empty($zdsuoluetu)){
if($n > 0){
$sltu=$strResult[1][0];
} else {
$sltu="{$zbp->host}zb_users/theme/{$zbp->theme}/image/random/{$random}.jpg";
}
}else{
$sltu=$zdsuoluetu;
}
$sltu="<img src=\"{$zbp->host}zb_users/theme/{$zbp->theme}/template/timthumb.php?src={$sltu}&w={$sltww}&h={$slthh}&zc=1\" alt=\"{$article->Title}\" />";
if($link==1){
$sltu="<a href=\"{$article->Url}\" title=\"{$article->Title}\">{$sltu}</a>";
}
return $sltu;
}
|