请问Dedecms去掉文章内容中的图片宽度和高度限制的办法
-
在内容页修改
{dede:field.body}
{dede:field.body runphp=yes} global $cfg_basehost; $str = @me; $search = '/(]+>)/is'; $search1 = '/(]+>)/is'; $search2 = '#()#i'; $search3 = '#()#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}
-
在保存时进行处理
- 修改
/dede/article_add.php
和/dede/article_edit.php
文件:$body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext'); // 去除img中的style属性 $body = preg_replace("/style=\.[^'\"<>]*['\"]/i", "", $body); // 去除img中的width,height属性 $exp = array("/height=.{0,5}\s/i", "/width=.{0,5}\s/i"); $exp_o = array("", ""); $body = preg_replace($exp, $exp_o, $body);
- 修改
更新时间:2025-04-10 23:39:53
下一篇:请问cms网站背景修改,如何在CMS网站中修改背景图片
转载请注明原文链接:https://www.muzicopy.com/suibi/3049.html