收藏
回答

如何在上传图片前对图片进行裁剪?

hi,如题,我想在上传图片前对图片进行裁剪,但是我用

ctx.drawImage(tempFilePaths[0], 0, 0, 90, 80);

类似这种方法报如下错误:

Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)';at SelectorQuery callback function

TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)'


请教大佬有没有简单一点的方法?


回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容
问题标签