datasync-blob 1.1.14 → 1.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DsBlob.js +19 -3
- package/package.json +1 -1
|
@@ -93,25 +93,41 @@ class DsBlob extends _react.Component {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
96
|
-
|
|
96
|
+
storeBase64ImageToImg = e => {
|
|
97
97
|
var image = document.createElement('img');
|
|
98
98
|
image.onload = this.reduceImage;
|
|
99
|
+
console.log("storeImageToImg:e.currentTarget.result = ", e.currentTarget.result);
|
|
100
|
+
alert("storeImageToImg !");
|
|
99
101
|
image.src = e.currentTarget.result;
|
|
100
102
|
};
|
|
101
103
|
|
|
104
|
+
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
105
|
+
storeBinaryImageToImg = e => {
|
|
106
|
+
var image = document.createElement('img');
|
|
107
|
+
image.onload = this.reduceImage;
|
|
108
|
+
console.log("storeBinaryImageToImg:e.currentTarget.result = ", e.currentTarget.result);
|
|
109
|
+
alert("storeBinaryImageToImg !");
|
|
110
|
+
// Convert ArrayBuffer to Blob URL since image.src cannot accept ArrayBuffer directly
|
|
111
|
+
const blob = new Blob([e.currentTarget.result]);
|
|
112
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
113
|
+
image.src = blobUrl;
|
|
114
|
+
};
|
|
115
|
+
|
|
102
116
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
103
117
|
readImageAsBase64 = async aPictureFile => {
|
|
104
118
|
let _reader = new FileReader();
|
|
119
|
+
console.log("readImageAsBase64:aPictureFile = ", aPictureFile);
|
|
105
120
|
alert("readImageAsBase64 !");
|
|
106
|
-
_reader.onload = this.
|
|
121
|
+
_reader.onload = this.storeBase64ImageToImg;
|
|
107
122
|
_reader.readAsDataURL(aPictureFile); //The readAsDataURL() method of the FileReader interface is used to read the contents of the specified file's data as a base64 encoded string.
|
|
108
123
|
};
|
|
109
124
|
|
|
110
125
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
111
126
|
readImageAsBinary = async aPictureFile => {
|
|
112
127
|
let _reader = new FileReader();
|
|
128
|
+
console.log("readImageAsBinary:aPictureFile = ", aPictureFile);
|
|
113
129
|
alert("readImageAsBinary !");
|
|
114
|
-
_reader.onload = this.
|
|
130
|
+
_reader.onload = this.storeBinaryImageToImg;
|
|
115
131
|
_reader.readAsArrayBuffer(aPictureFile); //The readAsArrayBuffer() method reads the file as genuine binary content without base64 conversion.
|
|
116
132
|
};
|
|
117
133
|
|