From 143a2e95379cea7fd88446fd24786500ec398f9b Mon Sep 17 00:00:00 2001 From: dmcBig Date: Tue, 7 Aug 2018 15:49:07 +0800 Subject: [PATCH] fileToBlob demo fileToBlob demo --- www/demo/demo.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/www/demo/demo.js b/www/demo/demo.js index 84f22ed..ce5c35a 100644 --- a/www/demo/demo.js +++ b/www/demo/demo.js @@ -19,6 +19,7 @@ function getThumbnail(medias) { //loading(); //show loading ui MediaPicker.extractThumbnail(medias[i], function(data) { imgs[data.index].src = 'data:image/jpeg;base64,' + data.thumbnailBase64; + imgs[data.index].setAttribute('style', 'transform:rotate(' + data.exifRotate + 'deg)'); }, function(e) { console.log(e) }); } } @@ -43,9 +44,28 @@ function compressImage() { } } + function loading() {} + //ios Video transcoding compression to MP4 (use AVAssetExportPresetMediumQuality) document.addEventListener("MediaPicker.CompressVideoEvent", function(data) { alert(data.status + "||" + data.index); -}, false); \ No newline at end of file +}, false); + + + +function getExifForKey(){ + MediaPicker.getExifForKey(resultMedias[i].path,"Orientation", function(data) { + alert(data); + }, function(e) { console.log(e) }); +} + + +function fileToBlob(){ + MediaPicker.fileToBlob(resultMedias[i].path, function(data) { + var blob = new Blob([data], {"type": "image/jpeg"}); + var domURL = window.URL || window.webkitURL; + imgs[0].src = domURL.createObjectURL(blob); + }, function(e) { console.log(e) }); +} \ No newline at end of file