How to Crop image and then start the upload with nuxt js?

See original GitHub issue

This is a really cool library. But after integrating it with my nuxt js app i am having hard time finding a solution to crop an image and then upload. Shown on the example Profile Picture Code

I have gone throw some of the documentation and its a lot to read. Here is my set up:

<client-only>
             <file-pond
               name="test"
               ref="pond"
               label-idle="Drop files here..."
               :allow-multiple="true"
               allowImagePreview="true"
               allowImageTransform="true"
               accepted-file-types="image/jpeg, image/png"
               :server="{ processFiles }"
               :files="myFiles"
               image-crop-aspect-ratio="1"
               allowImageCrop="true"
               v-on:init="handleFilePondInit"/>
           </client-only>
import vueFilePond, { setOptions } from 'vue-filepond';
import 'filepond/dist/filepond.min.css';
import 'filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css';
import FilePondPluginFileValidateType from 'filepond-plugin-file-validate-type';
import FilePondPluginImagePreview from 'filepond-plugin-image-preview';
import FilePondPluginImageCrop from 'filepond-plugin-image-crop';
import FilePondPluginImageTransform from 'filepond-plugin-image-transform';

const FilePond = vueFilePond(
  FilePondPluginFileValidateType,
  FilePondPluginImagePreview,
  FilePondPluginImageCrop,
  FilePondPluginImageTransform
);
export default {
      name: "vue-file-pond",
    data() {
      return {
        myFiles: []
      };
    },
    methods: {
      handleFilePondInit: function() {
        console.log('FilePond has initialized');
      },
      processFiles(filename, file, metadata, load){
        load(file);
      }
    },
    components: {
      FilePond
    },
    mounted() {
      setOptions({
        server: {
          url: process.env.APP_URL + '/api/images',
          revert: null,
          process: {
            withCredentials: false,
            headers: {
              Authorization: 'Bearer ABCD'
            }
          },
        }
      });
    }
  }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
TawsifKarimcommented, Mar 23, 2020

Thank you 😃

0reactions
rikschenninkcommented, Sep 25, 2021

@DeepMhta07 The edit button only appears when the Image edit plugin is set and an editor has been loaded.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image Crop and Upload in Vuejs - Medium
Today we will see how to crop the image and then upload it in vuejs The story starts when I am trying to...
Read more >
Three simple Steps to crop images in vue js. - The Koi
To crop images in vue you can use an awesome package called vue-image-cropper. You just need to first upload an image and pass...
Read more >
Nuxtjs brings unexpected token < when importing vue-image ...
I'm trying to make a cropped image and then upload it to amazon in my NuxtJs app. The problem comes when I import...
Read more >
Next.js Image Tutorial – How to Upload, Crop, and Resize ...
This post will teach you how to upload, crop, and resize images in the browser. I built this project in a Codesandbox. To...
Read more >
Cropping Images in the Browser with Vue.js - YouTube
Learn how to manipulate images in the browser using Vue. js and a simple JavaScript library called cropperjs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found