need jquery image resize, like if image width > 400 then use resize width:50%, other images that is smaller size like 100X100 dont need to be resized.
I use this code
var max_size = 400;
$(".comment p.message a.fancy img").each(function(i) {
if ($(this).height() > $(this).width()) {
var h = max_size;
var w = Math.ceil($(this).width() / $(this).height() * max_size);
} else {
var w = max_size;
var h = Math.ceil($(this).height() / $(this).width() * max_size);
}
$(this).css({ height: h, width: w });
});
But this code dont check smaller images.
Try this: http://jsfiddle.net/aJffu/2/
This halves the size of the image if either the width or height exceeds
maxsize. Shouldn’t be hard to adapt this to your specific needs. For example, this version scales the image such that the the longest dimension ismaxsize.