利用expression控制DedeCMS文章图片大小
模板部分:
<div class="content"> 
  {dede:field.body /} 
</div> 
CSS部分:
提示,图片高和宽最大都是600px,你可以自己修改图片宽度和高度。
.content img{ 
max-width:600px; 
max-height:600px; 
width:600px; 
height:600px; 
zoom:expression(function(el){ 
el.style.zoom = "1"; 
var resizeImg = function() { 
if (el.width > 600 || el.height>600) { 
if (el.width > el.height) { 
el.width = "600"; 
el.height = el.height / (el.width / 600); 
} else { 
el.height = "600"; 
el.width = el.width / (el.height / 600); 
} 
} 
} 
if (el.complete) { 
resizeImg(); 
} else { 
el.onload = function() { 
resizeImg(); 
} 
} 
}(this)); 
}