Hello, I’m looking to load .png files from my plugin directory but am having trouble. I suspect it may be due to folder permissions from accessing a file within UXP?
Can anyone provide an example of loading an image into a Image Object?
Getting image source path
var folder = pluginFolder.nativePath;
var image_path = `${folder}assets/image.png`,
Loading image path into Image() object
const img = new Image();
img.crossOrigin = "undefined";
img.onerror = () => reject(new Error('Couldn\'t load image'));
img.onload = () => resolve(Object.assign({}, source, { img }));
img.src = image_path;