解决dedecms调用图片列表时无法控制大小

时间:2022-04-01 10:49:42 投诉/举报

使用织梦dedecms调用图片标签一般为:{dede:arclistsg type=’image.’ imgwidth=’143′ imgheight=’106′ },但是显示出来的图片大小却无法控制!

解决办法如下:
如果需要在网站其他页面位置(比如首页)调用独立模型的图片列表,需要在{dede:arclistsg }中指定channelid;如:

  
  1. {dede:arclistsg channelid='-8' type='image.' imgwidth='143' imgheight='106' } 

这样才能保证能够读取到独立某型栏目的图片。 2. 读取到图片之后,无法在模板标签中通过imgwidth、imgheight控制图片的大小;解决办法:

打开/include/taglib/arclistsg.lib.php ,在192行找到如下代码:

  
  1. $row['image'] = "<img src='".$row['picname']."' border='0' alt='".ereg_replace("['><]","",$row['title'])."' />"

替换为:

  
  1. $row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."'>"; 

保存,退出,刷新页面,问题即可解决。