下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。内存溢出小编现在分享给大家,也给大家做个参考。
大部分手机站都是自适应的,这样图片就不能有宽高限制,我们添加文章图片时很多时候都会有 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.*?.*?)wIDth:d+px;([^"]*?.*?>)#i';
$search3 = '#(<img.*?.*?)height:d+px;([^"]*?.*?>)#i';
$content = preg_replace($search,'$1$3',$str);
$content = preg_replace($search1,$content);
$content = preg_replace($search2,'$1$2',$content);
$content = preg_replace($search3,$content);
@me = $content;
//@me = str_replace('/uploads/allimg/',$cfg_basehost.'/uploads/allimg/',$content);//手机版图片使用绝对路径
{/dede:fIEld.body}
其中
@me = str_replace('/uploads/allimg/',$content);
上述代码表示手机为二级域名时候,将附件地址改为绝对地址,以防止图片打不开的情况出现。
以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的织梦DedeCMS手机站去除文章内容图片自适应全部内容,希望文章能够帮你解决织梦DedeCMS手机站去除文章内容图片自适应所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)