-
展览展会信息类网站织梦...
-
电子元件电路板类网站织...
-
食品百货英文外贸类网站...
-
玩具动漫类网站织梦模板...
-
装饰建材公司类网站织梦...
-
钢结构岗亭营销型织梦网...
-
中英双语律师事务所类网...
-
仪器分析仪类网站织梦模...
-
水利工程施工类网站织梦...
-
精工机械轴承生产厂家类...
-
人力资源管理类网站织梦...
-
貂绒大衣服装设计类网站...
-
电脑系统软件下载类网站...
-
财税记账工商注册认证类...
-
仪器仪表科技公司类网站...
-
营销型无缝钢管定制生产...
-
蔬菜鲜果配送类网站织梦...
-
物流快运速递类网站织梦...
-
网站模板资源下载类网站...
-
手游APP软件下载类网站织...
打开/include/extend.func.php文件
在最下面加入
<span style="font-size:14px;">//文章body优化替换function replaceurl($newurl){global $dsql,$id;//获取图片附加表imgurls字段内容进行处$row = $dsql->GetOne("SELECT title FROM dede_archives where id=$id");//替换图片Alt为文档标题$newurl=str_ireplace(array('alt=""','alt=\'\''),'',$newurl);$newurl=preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU"," ",$newurl);$newurl=str_ireplace("<img " ,"<img alt=\"".$row['title']."\"",$newurl);//去掉结尾空格$newurl=str_ireplace(" /","/",$newurl);$newurl=str_ireplace(" />","/>",$newurl);return $newurl;}</span>
- 前段调用代码
{dede:field.body function='replaceurl(@me)'/}
需要图片中的style width height属性就把上面代码修改成下面的代码
<span style="font-size:14px;">//文章body优化替换function replaceurl($newurl){global $dsql,$id;//获取图片附加表imgurls字段内容进行处$row = $dsql->GetOne("SELECT title FROM dede_archives where id=$id");//去掉img的width和height$newurl=preg_replace('/style=\"width\:(.*)\"/','',$newurl);//替换图片Alt为文档标题$newurl=str_ireplace(array('alt=""','alt=\'\''),'',$newurl);$newurl=preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU"," ",$newurl);$newurl=str_ireplace("<img " ,"<img alt=\"".$row['title']."\"",$newurl);//去掉结尾空格$newurl=str_ireplace(" /","/",$newurl);$newurl=str_ireplace(" />","/>",$newurl);return $newurl;}</span>