$(function() {
$('#news_body_area img').each(function(i) {
var tmpImage = new Image();
tmpImage.src = $(this).attr('src');
if (parseInt(tmpImage.width) > 720) {
$(this).css('width', '720px');
}
});
});
var MYNEWS_PHOTO_LIMIT_WIDTH = parseInt("720");
$("img[xtype='photo']").load(function(obj) {
var title = $(this).attr('title');
$(this).attr('alt', title);
$(this).removeAttr('title');
var image_align_class = "";
var clazz = $(this).attr('class');
if (clazz != null && clazz.length > 0) {
image_align_class = " "+clazz;
}
$(this).attr('class', 'img');
$(this).removeAttr('xtype');
var w = parseInt($(this).css('width'));
if (isNaN(w)) {
w = 0;
}
var h = parseInt($(this).css('height'));
if (isNaN(h)) {
h = 0;
}
if (w <= 0) {
var timg = new Image();
timg.src = this.src;
w = parseInt(timg.width);
if (isNaN(w)) {
//...
}
}
if (w > MYNEWS_PHOTO_LIMIT_WIDTH) {
var pct = parseFloat(MYNEWS_PHOTO_LIMIT_WIDTH) / parseFloat(w);
w = MYNEWS_PHOTO_LIMIT_WIDTH;
if (pct > 0 && pct < 1 && h > 0) {
h = Math.floor(parseFloat(h) * pct);
}
}
$(this).css('width', w+"px");
if (h > 0) {
$(this).css('height', h+"px");
}
$(this).wrap("