我试图在画布上绘制图像,图像文件是使用file Uploader上传的。它在Chrome和IE10上工作得很好,但是在IE9上它坏了。我正在使用的createObjectURL方法在IE9上不受支持(我想..).Is有没有其他方法可以在IE9上完成这项工作?
我在画布上绘制图像的代码
var URL = window.webkitURL || window.URL ;
if ($("#rwAddImage_C_RadUploadImgfile0")[0].files[0] == undefined || $("#rwAddImage_C_RadUploadImgfile0")[0].files[0] == null) {
alert('Please select image');
return;
}
var url = URL.createObjectURL($("#rwAddImage_C_RadUploadImgfile0")[0].files[0]);
var img = new Image();
img.src = url;
img.onload = function () {
img_width = ($('#rwAddImage_C_txtImgWidth').val() != "" ? $('#rwAddImage_C_txtImgWidth').val() : img.width);
img_height = ($('#rwAddImage_C_txtImgHeight').val() != "" ? $('#rwAddImage_C_txtImgHeight').val() : img.width);
context.drawImage(img, imgPosX, imgPosY, img_width, img_height);
img_update();
cPush();
}发布于 2014-02-19 18:28:24
IE9不支持在不绕道服务器的情况下将图片“上传”到javascript。因此,为IE9解决此问题的唯一方法是将图像上传到服务器,然后在上传完成后再次从该服务器下载。
这将需要一些服务器端编程,使用PHP、NodeJS、ASP、JSP或任何其他服务器端web技术,您熟悉和可用的。
https://stackoverflow.com/questions/21873972
复制相似问题