찾아는 봐야겠지만..

fakepath와는 별개로


cropper.getCroppedCanvas({

  width: 160,

  height: 90,

  minWidth: 256,

  minHeight: 256,

  maxWidth: 4096,

  maxHeight: 4096,

  fillColor: '#fff',

  imageSmoothingEnabled: false,

  imageSmoothingQuality: 'high',

});


// Upload cropped image to server if the browser supports `HTMLCanvasElement.toBlob`

cropper.getCroppedCanvas().toBlob((blob) => {

  const formData = new FormData();


  formData.append('croppedImage', blob);


  // Use `jQuery.ajax` method

  $.ajax('/path/to/upload', {

    method: "POST",

    data: formData,

    processData: false,

    contentType: false,

    success() {

      console.log('Upload success');

    },

    error() {

      console.log('Upload error');

    },

  });

}); 


[링크 : https://github.com/fengyuanchen/cropperjs]


+

[링크 : https://www.npmjs.com/package/form-data]

[링크 : https://skout90.github.io/2018/08/24/Node.js/blob-객체-컨트롤/]

Posted by 구차니