07-27-2012 01:37 PM
final_image_blob = blackberry.utils.stringToBlob(data,"BASE64");
fileDir = "file:///store/home/user/camera";
//blackberry.io.dir.createNewDir(fileDir);
try {
blackberry.io.file.saveFile(fileDir + "/test.jpeg", final_image_blob);
} catch (e) {
alert('e.message = ' + e.message);
}
This shall do it for you
07-27-2012 01:39 PM
In WebWorks for the java smartphone, it looks like the base64 encoding works by decoding the Base64 (opposite of the TabletOS version).
You need to save it as a binary file if you are going to use it in other applications.
Have you tried converting the base64 content with another base64 converter to compare the results?
07-30-2012 12:53 PM
Hi,
Thanks for the code, i already solved.
This "request.overrideMimeType("text/plain; charset=x-user-defined");" download the image as binary then convert the responseText to base64 and use stringToBlob.
Finally just one more question... i´d saved small images but when i try to save a 213kb or 404kb image...doesn't work does anybody know why??
10-16-2012 04:45 PM
Is this supposed to work for jpeg files as well? I could get it to work for .png files but not .jpg files
ie:
var currentImgData = currentCanvas.toDataURL("file/jpeg");
currentImgData = currentImgData.replace('data:image/jpeg;base64,', '');
var currentBlobData = blackberry.utils.stringToBlob(currentImgData, 'binary');-Jacquie