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}
 
本文地址:https://www.baidu.com/

—-想了解dedecms织梦手机站内容页图片自适应标签分享!且更多的dd织梦教程关注<计算机技术网(www.ctvol.com)!!>

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cmsttfdreams/468999.html

(0)
上一篇 2020年10月27日
下一篇 2020年10月27日

精彩推荐