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

New Feature

nicholaschun opened this issue · comments

Please how do i display an image from a database in the preview panel of vue-picture-input..
Anybody have any idea?

I am sorry, but I really don't understand what you are trying to achieve. Care to share more context and some examples?

As a principle, I wouldn't save an image in a database, but if that is really what you need to do, you could save it in base64 (you can get the base64 string from this.$refs.pictureInput.image), and then use that value to set the prefill option as per the README:

  • 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.
  • prefillOptions: (object, optional) use this if you prefill with a data uri scheme to specify a file name and a media or file type:
  fileName: (string, optional) the file name
  fileType: (string, optional) the file type of the image, i.e. "png", or
  mediaType: (string, optional) the media type of the image, i.e. "image/png"

I am glad it was! :)
P.S. don't forget to star the project, if you find it useful.