
找到模板中代码的位置如:
<div class="picview">
{dede:field name='image'/}
</div>
将其替换为:
<div class="picview">
<img src="{dede:field name='litpic'/}" width="200" height="250">
</div>
这样就可以自由的实现各个模板中的大小啦,非常的方便!风信网络推荐大家采用此方法。
方法二:
修改文件:include/arcarchivesclassphp 262行
//模板里直接使用{dede:field name='image'/}获取缩略图
$this->Fields['image'] = (!eregi('jpg|gif|png', $this->Fields['picname']) '' : "<img src='{$this->Fields['picname']}' />");
将其替换为:
$this->Fields['image'] = (!eregi('jpg|gif|png', $this->Fields['picname']) '' : "<img src='{$this->Fields['picname']}' onload='javascript:if (thiswidth>400) thisstylewidth=400;'/>");
加上onload="javascript:if (thiswidth>400) thisstylewidth=400;"可以大小。超过400则只显示400,小于400的则显示实际大小。
这种方法有个缺点:每个都是width=400,对于某些显示可能会对页面效果造成影响。可以这样
12345{dede:productimagelist} <li> <img src="[field:imgsrc/]" alt="[field:text/]" width="500" height="400" /> </li>{/dede:productimagelist}
如果需要限制调用的数量,需要修改include/taglib/productimagelistlibphp文件。把你的<img src="{field:litpic /}"换成<img src="[field:image/]“试下,最上面的 {dede:arclist typeid=‘’ 为空换成{dede:arclist typeid=9 row=12 orderby=pubdate type='image' imgwidth='140' imgheight='44'}试下
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)