欢迎来到计算机相关教程网!

DedeCMS

当前位置: 主页 > CMS教程 > DedeCMS

dedecms织梦手机站内容页图片自适应标签

时间:2017-11-22 18:01:18|栏目:DedeCMS|点击:

大部分手机站都是自适应的,这样图片就不能有宽高限制,我们添加文章图片时很多时候都会有width height style,在手机站上要把它们清除,又不能影响电脑站的。
 
 
{dede:field.body runphp=yes}
global $cfg_basehost;
$str = @me;
$search = '/(<img.*?)width=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';
$search1 = '/(<img.*?)height=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';
$search2 = '#(<img.*?style=".*?)width:\d+px;([^"]*?.*?>)#i';
$search3 = '#(<img.*?style=".*?)height:\d+px;([^"]*?.*?>)#i';
$content = preg_replace($search,'$1$3',$str);
$content = preg_replace($search1,'$1$3',$content);
$content = preg_replace($search2,'$1$2',$content);
$content = preg_replace($search3,'$1$2',$content);
@me = $content;
//@me = str_replace('/uploads/allimg/', $cfg_basehost.'/uploads/allimg/', $content);//手机版图片使用绝对路径
{/dede:field.body}
 
本文地址:http://www.baidu.com/

上一篇:dedecms织梦手机站内容页图片自适应标签

栏    目:DedeCMS

下一篇:dedecms织梦中plus文件作用介绍及安全设置

本文标题:dedecms织梦手机站内容页图片自适应标签

本文地址:http://www.wangzhanteacher.com/index.php?m=home&c=View&a=index&aid=64

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:8044517 | 邮箱:8044517@qq.com

Copyright © 2022-2025 计算机相关教程网 版权所有冀ICP备17010187号