mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-12 07:43:11 +00:00
Add support for Buffers to utils.loadImage
If the user has preloaded image data in a Buffer, allow that user to use that data to load into a Fabric.js image. This is possible because node-canvas supports setting 'src' to a Buffer.
This commit is contained in:
parent
471dfed3c6
commit
5fc960aa56
1 changed files with 1 additions and 1 deletions
|
|
@ -77,7 +77,7 @@
|
|||
callback && callback.call(context, img);
|
||||
};
|
||||
var img = new Image();
|
||||
if (url && url.indexOf('data') === 0) {
|
||||
if (url && (url instanceof Buffer || url.indexOf('data') === 0)) {
|
||||
img.src = img._src = url;
|
||||
callback && callback.call(context, img);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue