Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use 'in' operator to search for 'canvas' in data:image/webp;base64... #56

Open
doublelam opened this issue Feb 5, 2018 · 2 comments

Comments

@doublelam
Copy link

doublelam commented Feb 5, 2018

when calling the method add(), if the argument is a string of dataURL, will encounter the error,
the codes in whammy

if('canvas' in frame){ //CanvasRenderingContext2D
	frame = frame.canvas;	
}
if('toDataURL' in frame){
	frame = frame.toDataURL('image/webp', this.quality)
}else if(typeof frame != "string"){
	throw "frame must be a a HTMLCanvasElement, a CanvasRenderingContext2D or a DataURI formatted string"
}
if (!(/^data:image\/webp;base64,/ig).test(frame)) {
	throw "Input must be formatted properly as a base64 encoded DataURI of type image/webp";
}

it seems that it is a little unreasonable

@L2L2L
Copy link

L2L2L commented Feb 17, 2018

Did you found a solution? I'm encountering the same problem but while runing add method directly on canvas which is said to run the toDataURL on the canvas object.

@doublelam
Copy link
Author

doublelam commented Mar 2, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants