How do i fill the selection with a image which is in the plugin folder


#1

How do i fill the artboard with a image which is in the plugin folder

const pluginFolders = await fs.getPluginFolder();
const entries = await pluginFolders.getEntries();
const compressedImage = await pluginFolder.getEntry('rendition.jpg');
let fill = new ImageFill(compressedImage);

selection.items[0].fill = fill(fill);

When I run the console says:
Plugin Error: Cannot load ImageFill from path: “my image file path”
at new ImageFill (plugins/BitmapFillWrapper.js:1:514)


#2

Is rendition.jpg in the top level of your plugin folder? And is the case identical?

If you’re using getEntry, you shouldn’t also need to use getEntries. But since you have that, can you console.log(entries) and see what’s in the directory?


#3

In the console it shows this:

[ {}, {}, {}, {}, {}, {} ]

when console.log(entries);


#4

There is a typo in the code:
line 1: ‘pluginFolders’
line 3: ‘pluginFolder’

HIH


#5

Thanks Alot
That helped!