alessiomaffeis / vue-picture-input

Mobile-friendly picture file input component for Vue.js 2-3 with image preview, drag and drop, EXIF orientation, and more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading from url

measwel opened this issue · comments

commented

Thank you for making the excellent vue picture input. My question is: how would I load the image not by click or drop, but from a given url? What function would I have to use for that?

you mean prefill?

  • prefill: (image url or File object, optional) use this to specify the path to a default image (or a File object) to prefill the input with. Default value: empty.
commented

hmmm I mean to programatically load an image from url as if the user had clicked on the input and chose a file.

Yes, prefill is your friend.
Remember that if it's not an URL on the same domain, you'll need to add a CORS policy and specify the allowed domains: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS