如题 我自己用的ripro主题自带的timthumb.php默认截取缩略图,默认的是从图片中间截取缩略图,导致列表和首页显示的缩略图看不到头看不到尾部一点也不美观,接下来教大家如何去设置代码从顶部开始截取缩略图方法。

方法很简单,用编码软件查找timthumb.php?所在的文件位置,例如ripro主题直接找到/wp-content/themes/ripro/inc/theme-functions.php文件中,’&zc=1&a=c&q=100&s=1′;//把&a=c改成&a=t

return get_template_directory_uri() . '/timthumb.php?src=' . $src . '&h=' . $size["h"] . '&w=' . $size['w'] . '&zc=1&a=c&q=100&s=1';//把&a=c改成&a=t

字母代表的各项值如下:
c : position in the center (this is the default)
t : align top
tr : align top right
tl : align top left
b : align bottom
br : align bottom right
bl : align bottom left
l : align left
r : align right

根据自己的需求’&zc=1&a=c&q=100&s=1′;去修改对应值的字母即可。

发表回复

后才能评论