本文主要讲解《DEDECMS让文章的大图片不破坏布局》的详细内容
{dede:field.body runphp='yes'}
$content = @me;
$mode1 = "/<img/";
$mode2 = "/height=\"(\d+)\" /";
$str1 = "<img onload=\"javascript:ImgReSize(this)\"";
$content = preg_replace($mode1,$str1,$content);
$content = preg_replace($mode2,"",$content);
@me = $content;
{/dede:field.body}
|
<script language='javascript'>
function ImgReSize(e)
{
if(e.width>670) // 670可根据你文章的内容区域大小,可调整
{
e.width=670; // 等同上面你设的那个数值
e.style.width="";
}
if(e.height>10)
{
e.style.height="";
}
}
</script>
|
本网刊登的文章均仅代表作者个人观点,并不代表本网立场。文中的论述和观点,敬请读者注意判断。
2021-02-24
2021-02-08
2021-02-08
2021-02-24
2021-02-08
2021-02-08
2021-02-08
2021-02-08