I can’t able to fetch local image, but image from url work perfectly!
am I missing something? Thanks in Advance!
I can’t able to fetch local image, but image from url work perfectly!
am I missing something? Thanks in Advance!
Best answer by Gleb
Firstly, fetch
is used for network requests via the URL, and your local images location is not a URL. Secondly, even if you could load local resources in your plugin somehow (which you can’t do since the plugin is run on the web and it doesn’t have access to your file system), all users will not have these images in their folder so they won’t be able to access them.
You need to either host images on the web somewhere to create the URL or embed them into your plugin code in base64 format. This way your plugin will be able to fetch them or use directly. The second method is not recommended for many images like in your case since the plugin will be too large and will take forever to load.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.