3
我開發與WinJS一個Metro應用將打開我的相機,拍照並創建一個圖片存儲Windows.Storage.StorageFile
對象上的負載引起的斑點(capturedItem)我想從他們創造一個blob對象如何從Windows.Storage.StorageFile WinJS
這是我的方法:
function imageCapture() {
var captureUI = new _capture.CameraCaptureUI();
captureUI.photoSettings.format = _capture.CameraCaptureUIPhotoFormat.jpeg;
captureUI.captureFileAsync(_capture.CameraCaptureUIMode.photo)
.then(function (capturedItem) {
if (capturedItem) {
var photoBlobUrl = URL.createObjectURL(
capturedItem,
{ oneTimeOnly: true });
imageElement = document.createElement("img");
imageElement.id = "img1";
imageElement.setAttribute("src", photoBlobUrl);
_divPicture.appendChild(imageElement);
// prints in textfield blob value
document.getElementById("field1").value = capturedItem.path;
}
}
);
}
希望這將幫助你: http://stackoverflow.com/questions/15904374/how-to-create-a-blob-object-from-image-url – Nirmal