简体   繁体   English

未捕获的TypeError:canvas.toDataUrl不是函数

[英]Uncaught TypeError: canvas.toDataUrl is not a function

I trying to resize an image and I am getting the uncaught TypeError message. 我试图调整图像大小,但收到未捕获的TypeError消息。

My code is: 我的代码是:

var file =  canvas.toDataUrl("image/jpeg", 0.5);

I was being lame and missed that the function name was not toDataUrl but toDataURL. 我很la脚,错过了函数名不是toDataUrl而是toDataURL。

So it should be written like: 所以应该这样写:

var file =  canvas.toDataURL("image/jpeg", 0.5);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM