//timthumb缩略图函数 已经把域名全部加上,好用七牛空间镜像 function post_thumbnail($width, $height, $dataSrc) { global $post; $blogUrl = 'http://' . $_SERVER['HTTP_HOST']; $isTimThumb = get_option('themes_fo2_TimThumb'); $first_img_src = catch_that_image(); $timthumbFlod = str_replace($blogUrl, '', get_bloginfo("template_url"));; if (has_post_thumbnail()) { //如果有缩略图,则显示缩略图 $timthumb_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID) , 'full'); $timthumb_src = str_replace($blogUrl, '', $timthumb_src[0]); if (isset($dataSrc)) { if (!$isTimThumb) { $post_timthumb = '<img ' . $dataSrc . '="' . $timthumbFlod . '/timthumb.php?src=' . $timthumb_src . '&h=' . $height . '&w=' . $width . '&zc=1" alt="' . $post->post_title . '" />'; } else { $post_timthumb = '<img ' . $dataSrc . '="' . $timthumb_src . '" height="' . $height . '" width="' . $width . '" alt="' . $post->post_title . '" />'; } } else { if (!$isTimThumb) { $post_timthumb = '<img src=' . $timthumbFlod . '/timthumb.php?src=' . $timthumb_src . '&h=' . $height . '&w=' . $width . '&zc=1" alt="' . $post->post_title . '" />'; } else { $post_timthumb = '<img src="' . $timthumb_src . '" height="' . $height . '" width="' . $width . '" alt="' . $post->post_title . '" />'; } } if (isset($timthumb_src{5})) { echo $post_timthumb; } } else { $first_img_src = str_replace($blogUrl, '', $first_img_src); if (!empty($first_img_src)) { //如果日志中有图片 if (isset($dataSrc)) { if (!$isTimThumb) { $post_timthumb = '<img ' . $dataSrc . '="' . $timthumbFlod . '/timthumb.php?src=' . $first_img_src . '&h=' . $height . '&w=' . $width . '&zc=1" alt="' . $post->post_title . '" />'; } else { $post_timthumb = '<img ' . $dataSrc . '="' . $first_img_src . '" height="' . $height . '" width="' . $width . '" alt="' . $post->post_title . '" />'; } } else { if (!$isTimThumb) { $post_timthumb = '<img src="' . $timthumbFlod . '/timthumb.php?src=' . $first_img_src . '&h=' . $height . '&w=' . $width . '&zc=1" alt="' . $post->post_title . '" />'; } else { $post_timthumb = '<img src="' . $first_img_src . '" height="' . $height . '" width="' . $width . '" alt="' . $post->post_title . '" />'; } } } else { //如果日志中没有图片,则显示默认 if (isset($dataSrc)) { $post_timthumb = '<img ' . $dataSrc . '="' . get_bloginfo("template_url") . '/images/default_thumb.gif" alt="' . $post->post_title . '" />'; } else { $post_timthumb = '<img src="' . get_bloginfo("template_url") . '/images/default_thumb.gif" alt="' . $post->post_title . '" />'; } } echo $post_timthumb; } }
收藏的用户(0) X
正在加载信息~
推荐阅读
最新回复 (1)
- itandfielnori 2017-4-6引用 2楼备份别人的代码,以防后期使用
站点信息
- 文章2312
- 用户1336
- 访客11622688
每日一句
Compliment yourself daily.
每天夸自己一句。
每天夸自己一句。
How to Ungroup Icons on Windows 11 Taskbar With a Registry Hack (and 2 More Ways)
反编译修改class文件变量
如何在大学成为一名优秀的程序员?
VMware NAT端口映射外网访问虚拟机linux
ubuntu下提取DSDT SSDT
使用HTML和CSS设计磨砂玻璃效果
解决android studio 4.4使用javah失败
vscode使用eslint自动代码格式化
c++浮点运算能力附安卓版
【源码】两种仪表盘
P2P中NAT之间的打洞可能性
jQuery的load方法Cannot read property 'indexOf' of undefined
【开源Roguelike游戏】素地牢源码
新会员