niclas_4
niclas_4

Reputation: 3674

vue-dropzone doesn't generate thumbnails on file add

I wanna add files that are already on my Server to the Dropzone, I tried to search my problem over vue-dropzone Docs as well as the normal dropzone docs and I also went through like 5+ github issues and tried the help approaches there but I did not seem to find the solution.

So I call this method:

    this.product.images.forEach(image => {
      const file = { name: 'Icon', type: 'image/jpeg', dataURL: image };
      this.$refs.dropzone.manuallyAddFile(file, image);
    });

The files get added correctly but I simply get no Thumbnail generated at all. Thats basicly the whole problem.

Upvotes: 0

Views: 2222

Answers (1)

mare96
mare96

Reputation: 3869

You can manually add thumbnail with emit:

this.product.images.forEach(image => {
      const file = { name: 'Icon', type: 'image/jpeg', dataURL: image };
      this.$refs.dropzone.manuallyAddFile(file, image);
      this.$refs.dropzone.dropzone.emit('thumbnail', file, file.dataURL)
      this.$refs.dropzone.dropzone.emit('complete', file)
    });

If your ref is dropzone you need to go to this.$refs.dropzone.dropzone.

And you need to call your method in @vdropzone-mounted="loadPictures".

Good luck!

Upvotes: 5

Related Questions