mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-10 23:03:10 +00:00
Avoid expensive regex when modifying data url string
This commit is contained in:
parent
1f206d039e
commit
ddacd57cc8
1 changed files with 2 additions and 1 deletions
|
|
@ -213,7 +213,8 @@
|
|||
replacement.height = imgEl.height;
|
||||
|
||||
if (isLikelyNode) {
|
||||
var base64str = canvasEl.toDataURL('image/png').replace(/data:image\/png;base64,/, '');
|
||||
// cut off data:image/png;base64, part in the beginning
|
||||
var base64str = canvasEl.toDataURL('image/png').substring(22);
|
||||
replacement.src = new Buffer(base64str, 'base64');
|
||||
_this._element = replacement;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue