热门推荐:企业建站|域名服务|云主机服务|小程序|推广优化

dedecms(织梦):电脑端查看内容图片无异常,手机端查看图片变形问题解决方案

2019-07-01 胜远威 胜远威科技
在后台找到模板-->默认模板管理-->选择手机内容模板-->点击修改:如图

点击后面的修改,找到以下标签代码:


 
{dede:field.body/}

替换成

{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 = str_replace('/uploads/allimg/', $cfg_basehost.'/uploads/allimg/', $content);//手机版图片使用绝对路径
{/dede:field.body} 


如图所示:修改后手机端访问即可正常。

                                                                                                                                                                                                                                                            上一篇  如何开启QQ登陆设置|快捷QQ登录设置|QQ快捷登录如何操作 下一篇  织梦图片变形优化方案