1
0
Fork 0
mirror of https://github.com/yunluo/gdk.git synced 2024-05-12 03:06:54 +02:00

优化缩略图显示逻辑

This commit is contained in:
云落 2020-02-13 19:07:45 +08:00
parent 38c616cac8
commit e27ef90cce
2 changed files with 7 additions and 3 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
desktop.ini
.ecloud/*
.git/
.git/
public/cache/*.txt

View file

@ -954,20 +954,23 @@ function gdk_thumbnail_src() {
/**
* 获取略缩图输出img标签代码
* @param [init] $way 缩略图方案代码1=cdn2=timthumb3=aq_resize
* @param [string] $url 缩略图原图链接调用gdk_thumbnail_src()
* @param [init] $width 缩略图宽度
* @param [init] $height 缩略图高度
* @param [string] $style 图片样式cdn方案时有效
* @param [string] $atrr img标签的属性
* @return [string] img标签的图片代码
*/
function gdk_thumb_img($way,$url,$width,$height,$style,$atrr = 'class="thumb_img"'){
function gdk_thumb_img($way,$width,$height,$style = '',$atrr = 'class="thumb_img"'){
$url = gdk_thumbnail_src();
if ($way === 1) {//cdn
$src = $url.'!'.$style;
}elseif ($way === 2) {
$src = GDK_BASE_URL . '/public/timthumb.php?src='.$url.'&h='.$height.'&w='.$width.'&q=90&zc=1&ct=1';
}elseif ($way === 3) {
$src = aq_resize( $url, $width , $height , true);
if(empty($src)){
$src = GDK_BASE_URL . '/public/timthumb.php?src='.$url.'&h='.$height.'&w='.$width.'&q=90&zc=1&ct=1';
}
}else{
return false;
}