I have an array of remote images I want to fetch and pass into user selected placeholders. In the plugin UI I have image data, like…
const data = =
{name: 'One', image: 'https://foo.com/img1.jpg'},
{name: 'Two', image: 'https://foo.com/img2.jpg'},
]
I understand I need to fetch each one and convert to base64, along the lines of:
fetch(url)
.then(r => r.arrayBuffer())
.then(a => new Uint8Array(a))
and then eventually parent.postMessage(...)
with the data. But I don’t know the best way to grab the image data and prepare it to pass it through.