window.onload=function(){
auto_data_size();
};
function auto_data_size(){
var imgss= $("figure img");
$("figure img").each(function() {
var imgs = new Image();
imgs.src=$(this).attr("src");
var w = imgs.width,
h =imgs.height;
$(this).parent("a").attr("data-size","").attr("data-size",w+"x"+h);
})
};
希望对你有所帮助