I am developing a React Native application. I have an AWS Amplify backend set up for my up, including the S3 bucket. I am using an ImagePicker package for adding existing photos from the device storage and taking new photos using the device camera. I get a base64 string as a response from the ImagePicker that does the job of showing this string as a normal image on the screen. Now I need to save this image to the S3 bucket and I am not sure what's the right strategy for that. It does save it just as a string in a document but I wonder if there is a way to save it as a real image to the S3 bucket? Like convert base 64 string to an image and upload it to the storage? Or what would be the right approach here?
Related
I'm working on a Lambda function which fetches images from a Google drive and uploads it to S3 bucket.
The format of the data I'm working with is a Buffer and when I upload it to S3 bucket the size is 2.8mb. However I need to compress it to be under 2mb. I can't seem to find a suitable library which can handle this server side.
Any advice?
For compressing images and storing it, you may use Jimp which is an image processing library and provides all the facilities you're looking for.
For reference, you may go to this documentation
I am working on an Angular application using PrimeNG and storing some uploaded image on Firebase Storage service.
In order to upload images I am using this PrimeNG component named FileUpload: https://primefaces.org/primeng/showcase/#/fileupload
Then the images are correctly saved on Firebase Storage service. It works fine. Each time that I drag and drop an image to be uploaded I have something like this:
As you can see in the previous screenshot, eacht time that I drag and drop an image I obtain this uploadedFiles array that contains object having File as type.
What exactly is this File type? Is it a PrimeNG custom type or is it this JS object? (this one: https://developer.mozilla.org/en-US/docs/Web/API/File)
In case how can I retrieve a specific image from Firebase Storage service into one of this File object?
how can I retrieve a specific image from Firebase Storage service into one of this File object?
After a file is uploaded to Firebase Storage, there is no way in the Firebase JavaScript SDK to get it directly to a local file. While the iOS and Android SDKs have this option, the JavaScript SDK only allows downloading the data via a so-called download URL.
This is clearly shown in the console that File is a javascript array which may contain multiple uploaded image object. To get the first image object you do something like that -
File[0].objectURL.SafeUrlImpl
The previous line of code will retrieve the object URL.
I have a large image stored in firebase storage. Is there a way to get a resized version of that image to display? Current image takes a lot of bandwidth.
Several ways to do this:
Compress images client side and upload smaller photos
Use a Google Cloud Function or Google App Engine to resize/compress the photos after upload
Use the Google App Engine Images API to generate serving URLs that you can then resize on the fly by requesting different (as mentioned in the blog post in the comment)
Integrate with Imgix/Cloudinary to generate serving URLs with the above properties
I'm using fineupload S3 in an angular mobile web application to handle the capture and upload of images from the device camera.
I have a requirement to make sure that the captured images are not displayed in the device gallery and not stored on the device. (image and video)
The deleteFile function of fineupload doesn't appear to handle this task and it instead looks like its designed to delete the uploaded file from the server.
So i'm looking for a solution to either prevent the device from storing the captured images in the first place or to delete the files once they've been uploaded.
As far as I know the browser (either mobile or desktop) does not have the privileges to manipulate the file system. If your using cordova/phonegap you should try removing the photo with the file system API provided by them.
I am using slingshot to upload some images in my Amazon s3 and it works like charm. Nevertheless, I want to use slingshot to upload some files (text,doc,odf etc) too in my Amazon s3. BUT, I want to convert all these files into PDF first before uploading into s3. I am familiar with nodeJs package like "https://github.com/gfloyd/node-unoconv", that converts file into PDF. But how would i be able to integrate it into slingshot.
Eventually all the text, doc, etc files, that the client uploads, I want them to be stored in S3 but in PDF format. So is there any way to do that.
Amateur in meteor, so would be grateful if the explanation is detailed.
Thanks.
Slingshot is uploading directly to S3 so I am not sure how you would efficiently convert the files before the upload. You could do it client side, but this is obviously not 100% reliable and can be heavy for the client.
For a recent application I used Amazon Lambda in order to do images resizing as soon as they are uploaded to an S3 bucket.
It is very easy to use. You just have to create a package with your code and upload it to Lambda and then trigger the Lambda function when a file is uploaded to S3.
The service is really cheap and the tutorial is easy to follow. It is about file resizing but it should be easy to modify in order to do PDF conversion as you can use any npm package.
There is a lot of steps involved: create S3 buckets, create IAM roles, create a Lambda function, etc. But as soon as it is configured it is quite reliable.
I think it is the best tools to pair with S3 especially when you are uploading directly to buckets.