readFiles(files, callback) {
    // check each file for an image
    [].forEach.call(files, file => {
      if (!file.type.match(/^image\/(gif|jpe?g|a?png|svg|webp|bmp|vnd\.microsoft\.icon)/i)) {
        // Note that some file formats such as psd start with image/* but are not readable
        return;
      }

      const reader = new FileReader();
      reader.onload = (evt) => {
        callback({
          src: evt.target.result
        });
      };

      // read the clipboard item or file
      const blob = file.getAsFile ? file.getAsFile() : file;
      if (blob instanceof Blob) {
        reader.readAsDataURL(blob);
      }
    });
  }
// Extract image URIs a list of files from evt.dataTransfer or evt.clipboardData
Extract image URIs a list of files from evt.dataTransfer or evt.clipboardData
Extract image URIs a list of files from evt . dataTransfer or evt . clipboardData
readFiles(files, callback) {
    [].forEach.call(files, file => {
      if (!file.type.match(/^image\/(gif|jpe?g|a?png|svg|webp|bmp|vnd\.microsoft\.icon)/i)) {
        return;
      }
      const reader = new FileReader();
      reader.onload = (evt) => {
        callback({
          src: evt.target.result
        });
      };
      const blob = file.getAsFile ? file.getAsFile() : file;
      if (blob instanceof Blob) {
        reader.readAsDataURL(blob);
      }
    });
  }
readFiles ( files , callback ) { [ ] . forEach . call ( files , file => { if ( ! file . type . match ( / ^image\/(gif|jpe?g|a?png|svg|webp|bmp|vnd\.microsoft\.icon) / i ) ) { return ; } const reader = new FileReader ( ) ; reader . onload = ( evt ) => { callback ( { src : evt . target . result } ) ; } ; const blob = file . getAsFile ? file . getAsFile ( ) : file ; if ( blob instanceof Blob ) { reader . readAsDataURL ( blob ) ; } } ) ; }
Extract image URIs a list of files from evt.dataTransfer or evt.clipboardData
Extract image URIs a list of files from evt . dataTransfer or evt . clipboardData
// check each file for an image // Note that some file formats such as psd start with image/* but are not readable // read the clipboard item or file