我正在向服务器发送请求,并在表中的base 64中获取图像,例如
每个时间图像都是可变尺寸的。
所以现在我想在javaScript中设置图像的高度和宽度。
脚本代码
function getSignature(signUrl, accountNumber) { $.ajax({ url: signUrl, data: ({accountNumber : accountNumber}), success: function(data1) { $('#signDiv').show(); $('#signDiv').html(data1[0]); enter code here } }); } in jsp I have declared and on click fetcing image and howing in getting response as
答案 0 :(得分:0)
您只需加载图像并获取其宽度和高度
var img = new Image();
img.src = "Your base64 image";
if (img.complete) {
alert('width: '+img.width);
}
else {
img.onload = function() {
//load if not loaded
alert('width: '+img.width);
}
}