UNPKG

react-filerobot-image-editor

Version:

React component version of filerobot image editor (FIE).

1 lines 540 B
import extractNameFromUrl from"./extractNameFromUrl";var loadImage=function(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(c,d){var e=b.noCrossOrigin,f=b.name,g=b.width,h=b.height,i=b.key,j=new Image;e||(j.crossOrigin="Anonymous"),j.src=a,j.name=null!==f&&void 0!==f?f:extractNameFromUrl(a),j.key=i,j.onload=function(){j.width=g||j.width,j.height=h||j.height,c(j)},j.onerror=function(){d(new Error("Error in loading the image with the provided url: ".concat(a)))}})};export default loadImage;