How To Create A Blob Object From Image Url?
I am using Winjs(javascript for windows 8 app). what I want is to create a simple blob object from a specific url of my static image by giving the path. What is the solution? Any h
Solution 1:
'MSApp.CreateFileFromStorageFile()` as used below will work. if you need to send the file using WinJS.xhr() you can set as data in xhrOptions.
var uri = new Windows.Foundation.Uri('ms-appx:///images/IMG_0550.jpg');
varself = this;
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).then(functionongetfilecomplete(storageFile)
{
var file = MSApp.createFileFromStorageFile(storageFile);
var url = URL.createObjectURL(file, { oneTimeOnly: true });
// assume that this.imageElement points to the image tagself.imageElement.setAttribute('src', url);
}).then(null, functiononerror(error)
{
});
refer the link in case you are looking for upload the blob to azure. For send the blob to your webservice also, code will be on these lines.
Post a Comment for "How To Create A Blob Object From Image Url?"