Closed tschofen closed 2 years ago
Turns out, that the issue is that the generated Blob object must be cast to a File object and that only seems to work when most of the File properties are properly set. This did the trick...
function blobToFile(theBlob, fileName) {
return new File([theBlob], fileName,{ lastModified: new Date().getTime(), type: theBlob.type })
}
I'm trying to add an image to an uploader.queue that was captured via computer camera. I captured the image from a canvas convert it into a blob (instance of Blob is true at that point) and pass it into the uploader instance;
I then render the queue with ng-thumb. Unfortunately, ng-thumb can't render the preview as it doesn't recognize the created blob as a blob or as a file (instanceof Blob or instanceof File are both false) and therefore never finishes drawing the preview.
Any idea how I can make the captured file render for the preview?
The salient Javascript parts.
And the HTML: