How to remove the style width height attribute in img in DreamWeaver

织梦怎么去除img中的style width height属性?
织梦去除img中的style width height属性
在做响应式的织梦模板时,经常会遇到图片无法自适应的问题,原因是织梦的编辑器在上传图片时,会自动加上style属性,因此,在保存文章时,我们需要先清除掉这些属性
推荐学习:织梦cms
在dede/article_add.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);The above is the detailed content of How to remove the style width height attribute in img in DreamWeaver. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Linux new version
SublimeText3 Linux latest version





