"How to make network requests" suggests overcomplicated way to create ImageFill
Closed this issue · 2 comments
Submit an issue
Topic
This is an issue regarding:
- The tutorials contained within this repo.
- The samples contained within this repo.
Description of the issue
https://adobexdplatform.com/plugin-docs/tutorials/how-to-make-network-requests/
I think this tutorial is based on the prerelease version of ImageFill that could only load data from Base64 -- that's not the case in the shipping APIs though.
After step 3, where you have the downloaded image data in an ArrayBuffer, the tutorial tells you to convert the bytes to a giant base64 string (which requires pulling an open-source library into your project), then add a hardcoded prefix to that and feed it into ImageFill.
Instead, the recommended practice after step 3 would be to write the ArrayBuffer to a temp file. Then you can just feed that file to ImageFill. The code is cleaner, it's faster, and no 3rd-party libraries are needed.
I wanted to post a link to this as a reply in https://forums.adobexdplatform.com/t/problem-with-generating-pixel-representation-of-image-upload-in-adobe-xd/592, so maybe we can do that once it's been updated?
the tutorial updated to reflect the updated ImageFill
API