html5 - large Images Canvas with FF -



html5 - large Images Canvas with FF -

i have pronlem big image files display in canvas filereader. little images works fine, in chrome big images too. in firefox displays nil , after todataurl gives black image. image size 5580 * 8333 (8mb). if load dataurl filereader in image tag works too.

var reader = new filereader(); reader.onloadend = function () { preview.src = reader.result; console.log(reader.result); var canvas = document.getelementbyid("resize"); var ctx = canvas.getcontext("2d"); var image = new image(); image.src = reader.result; image.onload = function() { var max_width = 400; var max_height = 300; var tempw = image.width; var temph = image.height; if (tempw > temph) { if (tempw > max_width) { temph *= max_width / tempw; tempw = max_width; } } else { if (temph > max_height) { tempw *= max_height / temph; temph = max_height; } } image.width=tempw; image.height=temph; canvas.width = tempw; canvas.height = temph; ctx.drawimage(image, 0, 0, tempw, temph); }; } if (file) { reader.readasdataurl(file); } else { preview.src = ""; } }

thanks help

html5 image firefox canvas large-files

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -