How to make the user of our plugin select images and import them into his artboard in form of layers from his computer?

I am stuck on creating a plugin that would make the user do the following:
1.User should be able to select images from his computer by interacting with our plugin.
2.User must be able to selct images like Foreground Image and Background Image.

Could anybody suggest the methods and javascript functions that would help me design a plugin that would do the above things.

Hi San, Welcome to the forums! The docs have some examples of reading a file here.

That has a link of adding Text. You would want to add as many Rectangles as you have files and use the ImageFill class to set them.

Check out the ImageFill class,
https://adobexdplatform.com/plugin-docs/reference/ImageFill.html?h=imagefill

The sample repository is helpful for creating your first plugin,

1 Like

Thanks, that helps.
Will the image fill method import images as separate layers ?
And if so will I be able to rename the imported image layer to ordered name like Layer 1, Layer 2 ?
And I have another question, Is there any reference page which displays every methods and its functions that I can do in Adobe XD plugin creation ?

Here’s the documentation,

https://adobexdplatform.com/plugin-docs/

API
https://adobexdplatform.com/plugin-docs/reference/reference-index.html

I don’t think the page shows every method.

The example I linked to that shows how to read a file shows how to add a layer. You can name the layer when you add it using the name property.

1 Like

Thanks for the help!

With :heart:
-San

1 Like