Click here to Skip to main content
15,888,037 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to draw image on canvas, the image file is uploaded using File Uploader. It's working fine on Chrome and IE10 however it breaks on IE9.The createObjectURL method which i am using is not supported on IE9(i guess..).Is there any alternative way to get this work on IE9?

My code for drawing image on canvas
JavaScript
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();
   }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900