diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-01-13 18:08:49 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-01-13 18:08:49 +0100 |
| commit | 6710b9f7f223acd01ac82171d9f9f4eb577f5885 (patch) | |
| tree | e8328f43f107e5c5dbef2aeb8b2746239a44508a /client/common | |
| parent | 47b6ae0f8ad2f49692222bb0c800e7ba1eb4b94b (diff) | |
serializing image failed, writing to tmp file instead
Diffstat (limited to 'client/common')
| -rw-r--r-- | client/common/upload.helpers.js | 6 | ||||
| -rw-r--r-- | client/common/uploadImage.component.js | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/client/common/upload.helpers.js b/client/common/upload.helpers.js index 5a041fd4..eb42a993 100644 --- a/client/common/upload.helpers.js +++ b/client/common/upload.helpers.js @@ -15,15 +15,15 @@ function base64ToUint8Array(string, start, finish) { } function getOrientation(uri) { - const exif = new ExifReader() // Split off the base64 data const base64String = uri.split(',')[1] // Read off first 128KB, which is all we need to // get the EXIF data const arr = base64ToUint8Array(base64String, 0, 2 ** 17) try { - exif.load(arr.buffer) - return exif.getTagValue('Orientation') + const tags = ExifReader.load(arr.buffer) + // console.log(tags) + return tags.Orientation } catch (err) { return 1 } diff --git a/client/common/uploadImage.component.js b/client/common/uploadImage.component.js index eb8cc60f..bc88828e 100644 --- a/client/common/uploadImage.component.js +++ b/client/common/uploadImage.component.js @@ -20,7 +20,7 @@ export default class UploadImageComponent extends Component { img.onload = null this.resizeAndUpload(img) } - img.src = fileReaderEvent.result + img.src = fileReaderEvent.target.result } fr.readAsDataURL(files[0]) } @@ -28,6 +28,7 @@ export default class UploadImageComponent extends Component { resizeAndUpload(img) { const canvas = renderThumbnail(img) canvas.toBlob(blob => { + // console.log(blob) this.props.onUpload(blob) }, 'image/jpeg', 80) } |
