复制到e/class/userfun.php 中
- <?php
- function getImgs($content,$order='ALL'){
- $pattern="/<img.*?src=['|"](.*?(?:[.gif|.jpg]))['|"].*?[/]?>/";
- preg_match_all($pattern,$content,$match);
- if(isset($match[1])&&!empty($match[1])){
- if($order==='ALL'){
- return $match[1];
- }
- if(is_numeric($order)&&isset($match[1][$order])){
- return $match[1][$order];
- }
- }
- return '';
- }
- ?>
然后在列表模板勾选(list.var) ,调用
图片等比例缩放css代码为:
- $myimg=getImgs($r[newstext]);
- $listtemp=' <li> <DIV class="thumbImage" ><img src="'.$myimg[0].'" /></div><a href="[!--titleurl--]" title="[!--oldtitle--]" target="_blank">[!--title--]</a></li> ';
- <style type="text/css">
- .thumbImage img{
- MAX-WIDTH: 100%!important;HEIGHT: auto!important;width:expression(this.width > 60 ? "60px" : this.width)!important;
- }
- .thumbImage {MARGIN: auto;WIDTH: 60px;}
- *html.thumbImage img{
- width:expression(this.width>60&&this.width>this.height?45:auto);
- height:expresion(this.height>45?45:auto);
- }
- </style>