I got confused in this situation. Im working on a new project like adding photo and description or other text input. I read a article it is doing this but it's old article.
My app like this; user will add a photo, title and description. Just like a simple Instagram.
(Honestly Im not gonna do instagram. :] )
(Also you can find it here:
https://fireship.io/lessons/flutter-slider-like-reflectly/.)
Is it possible to do that in Firebase Firestore ? Or should i use Cloud Storage?
If I have to use Cloud Storage, how can I add photo description or other text input.
I couldn't find any example like this in Google.
For a user to upload images to your app you would need something like Firebase Storage to host the images, so you will need Cloud Storage anyways. regarding the description, its possible to attach custom metadata to files in Cloud Storage (description, location, title etc...) However if you are going for something more complex, using Firestore together with Storage is probably your best bet. You could store a document for each image in an image collection in firestore and have the imageUrl field point to the Hosting URL along with any other data you might want
You need to use both, you should upload the image in cloud storage and after upload you will get a link of this file. Then you can add this link in firestore document with other information as well such as description or other text input like you wanted.
Related
I want to get a URL like this:
https://i.imgur.com/jgkiXHE.jpeg
and this is the firebase link I get:
https://firebasestorage.googleapis.com/v0/b/zendle.appspot.com/o/zeThumbs%2FjgkiXHE.jpeg?alt=media
I want to use the link to check for mature content using this website:
https://moderatecontent.com/
is there any way I can get the preview of the firebase storage images (by getting rid of ?alt=media)
thanks
I have a rich text component in my form and can add text, images, video etc. Everything gets saved in one field in Cloud Firestore. When I include images with the text, they come up as src="...." in between the text which is fine. But what does this mean? Do the images get stored into Cloud Firestore? I know you're not supposed to do that. Is Firebase going to charge me in the future if I have a lot of images/videos etc?
As the images get passed as part of the 'content' field that can include text, you can't separate them and store them in storage. At least I don't think so.
I guess what I'm asking is, is this ok? Am I going to have any issues in the future in terms of how many images the db can handle or being charged for it? I just don't understand where the images are being saved.
What you have in your screenshot is a base64 encoded image. So all the data for the image is encoded in the URL itself.
This is not uncommon for smaller images, as it saves the browser from having to make another request to get the image. And as long as your total document size remains under the 1MB limit that Firestore has, it is in itself fine.
If you see this regularly and the images are non-trivial, you might want to see if you can extract the binary data and store it in Cloud Storage. One reason for that is cost control: on Firestore you pay $0.18/GiB, while on Storage that is $0.026/GB (as per the Firebase pricing page).
I want to crop the Size of an Image directly in the url
I uploaded the images in FireBase and I'm willing to know if they offer this feature.
Any advice and suggestion would be appreciated!
No, this is not a product feature offered by Firebase or Google Cloud products.
Well, firebase does not provide any method to compress or crop images while uploading images. You can crop images before uploading to firebase using:
https://github.com/ivpusic/react-native-image-crop-picker
If you know what sizes you want (maybe your app use predefined image sizes depending on the platform / screen width), you can use this firebase extension (blaze plan).
When you upload an image on storage, it creates multiple resizes on your bucket.
Could be useful depending on your needs.
Edit
For my apps, I wrote a cloud function to upload images on my bucket (React-native expo)
I post my base64 image on an http cloud function and use sharp to resize it.
Then I save my image on my bucket and store its url on firestore (on a document related to this image, a product in my case)
I'm currently building a messaging app with Meteor for fun, and I've stumbled into problem I'm not sure of how to solve. I want to replicate the functionality of apps like iOS Messages, WhatsApp, etc. where users can either enter text or some type of media: image, video, gif, etc.
My question is how do I structure the schema for my Messages collection, and how do I correctly store the data? My initial thought is to store the src of the media as the message content and use an {{#If image}} conditional to render the correct templates.
Is this the correct way to approach this problem? Am I missing anything?
You will first have to upload the media file to your server or to the cloud. The CollectionFS package should be useful to you. Once you have a shareable url for the media file you can save that in your messages collection. Alternatively you can put the _id of the media file in your messages collection as a foreign key.
Hey guys! Any Alfresco experts out there?
I have created a document type in Alfresco and am trying to associate it with an image -- Somehow. I don't really mind how it's done - an image uploader in the metadata section when saving the actual document would be nice, but I can live with having to upload the image first and then associating it somehow with the document.
Any ideas..?
First read how to create relationships between nodes (the nodes being a document and an image).
Then implement it within a custom dialog.
Have you taken a look at the thumbnail service? It allows you to create thumbnails of documents / images. This is the official doc and a good blog post here.
Even if you don't use it, you can take a look at how its content model works and implement something similar.