Hi, I am a newbie with Fuse. How can i upload image from camera to AWS S3.
Thanks.
Hi, I am a newbie with Fuse. How can i upload image from camera to AWS S3.
Thanks.
Hey, currently available methods are a bit dodgy, but we’ve got a new camera API coming up, and we’re making a complete camera example project that will demonstrate how to do this, and it shouldn’t be long. Stay tuned
Any news on this sample project. I need to upload a jpg as described in this post.
Try using https://www.fusetools.com/docs/fuse/cameraroll/cameraroll api then use fetch
to upload
Thanks for the tip, once I have the image in a variable or path for the image, how would I upload it?
Hey Chris,
I’m using the following, might work for you too:
var reader = new FileReader();
reader.onloadend = function() {
// the contents of the file are in reader.result
// ...
};
reader.readAsDataURL(file);
Thanks, this reads images from URLs, I need the other direction and upload the image to a web server
Send the base64 code to your server and handle it there. Do that with fetch
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
No Chris, it does not. You pass the file object that you get from CameraRoll or Camera to the readAsDataURL()
function.
Camera.takePicture().then(
function(image) {
var reader = new FileReader();
reader.onloadend = function() {
// the contents of the file are in reader.result
// ...
};
reader.readAsDataURL(image);
}
);
No use the ImageTools
api, take a look at this for an example
Great advise guys, thanks. I’ll look at this in detail tonight after work and confirm.
How did you solve this? Trying to do the same thing and want to avoid base64 encoding the image.
How did you solve this, I need it?
As far as i know the bug with ImageTools.getBase64FromImage is not solved so it would be nice to have a full working example.
I got it working:
cameraRoll.getImage()
.then(function(image) {
ImageTools.resize(image,
{
mode: ImageTools.KEEP_ASPECT,
desiredWidth: 600,
desiredHeight: 600
})
.then(function(newImage) {
var reader = new FileReader();
reader.onloadend = function() {
imgBase64 = reader.result;
};
reader.readAsDataURL(newImage);
});
and then upload the imgBase64 var