how to save image in fabruc js json 1

how to save image in fabruc js json

fabric.Image.prototype.toObject = (function(toObject) {
  return function() {
    return fabric.util.object.extend(toObject.call(this), {
      src: this.toDataURL()
    });
  };
})(fabric.Image.prototype.toObject);

Here is what the above code is Doing:
1. It’s adding a new method to the fabric.Image.prototype object called toDataURL.
2. It’s overriding the toObject method of fabric.Image.prototype.
3. It’s calling the original toObject method and extending the result with a new property called src.
4. It’s setting the value of the src property to the result of calling the new toDataURL method.

Similar Posts