flutter firebase storage issue with image url [duplicate] - firebase-storage

This question already has answers here:
Download URL not present in Firebase Console
(3 answers)
Closed 2 years ago.
hello iam new to flutter and firebase , I'm making an ecommerce app using firebase and I want to store images manually in the console in the storage and then retrieve it with all the product value that i have stored in the firestore database , when I upload a new image to my storage there is no url for it , how to get the url and then put it as a string in product document nd get it in flutter ?

If you go above the "Size" segment, you'd see a "Name" field that has Hyper-Link on it.
Press on the name and it would transfer you to the URL of the photo

Related

I am getting this error while am trying to bring data from cloud firestore to my flutter app

ERROR - >
Invalid argument(s): No host specified in URI file:///data/user/0/com.example.hangout/cache/scaled_8213e05d-3981-48c7-ac51-d57a3ab4b8f04882445254643686983.jpg
here is the code for the dashboard screen
dashboardScreen.dart
The problem is that you are storing the images without the full URL and trying to display it without concatenating it with the base url.
You have to options:
Concatenate the image path with the base URL in the NetworkImage.
Store the full pathof the image in the Firestore.

Create simple product in magento 2 and add full url images?

sorry for my english.
I have a store in Magento 2, and when the user search for some product that not exist in my db, i send a request to a external api that return a list of 10 products, so my idea is create these products on the fly using the m2 api and send 10 request in parallel, the problem is the images, if i have to download each images for each product and convert to base64 to then upload in other request, the performance is too bad.
Is there the possibility to in the same request (mysqite.com/rest/V1/products) create the products and add the full url image to each one?

Upload JSON Request as a background task in Flutter

I have a requirement where I want to upload JSON request data(fetch from database tables) to server and get the response, based on response I have to update local database(sqflite: ^1.2.1).
I have multiple screens and I need to create different JSON request data on every screen based on user action. Currently for same scenario I am using Intent Service in my another native android application.
What is the based way to handle such type of scenario in flutter Android application. If I use channel and implement Intent Service then I can't access sqflite database in Android specific region. If internet is not available then I have to keep waiting for connectivity, when device get connectivity then I need to upload all the created events to server one by one.
Please someone advise me the based possible way to handle this specific scenario in Flutter.
Thanks in advance
Save your JSON requests locally first using sqflite or sharedPreferences for instance. Once they are synced to your served, remove them from sync queue
I got the solution: I am able to access SQFlite database in native through channel.
This is the path of the database created in flutter
"/data/data/{package name}/app_flutter/{database file name}"
So we can access like in native using channel
SQLiteDatabase mDatabase= SQLiteDatabase.openDatabase("/data/data/{package name}/app_flutter/{database file name}", null, 0);
Log.i("MainActivity", "mDatabase.isOpen():"+mDatabase.isOpen());//check DB is open or not
String query = "SELECT * FROM {Table Name}";
Cursor cursor=mDatabase.rawQuery(query,null);
if (cursor.moveToFirst()){
do{
String data= cursor.getString(cursor.getColumnIndex({Table Column Name}));
Log.i("MainActivity", "Column Data Value:"+data);
}while(cursor.moveToNext());
}
cursor.close();
So I will implement Service in native to achieve this scenario.
Thank You

can i upload posts with the same auto id? swift 4 firebase

Is it possible to upload a post to firebase to 3 different locations and with the same autoId sense the posts is exactly the same. So I have just managed to let users to delete their posts, but when they upload the posts it is actually uploaded to 3 different locations like this
// this uploads the "post" to a global page
Database.database().reference().child("posts").childByAutoId().setValue(postObject)
// this uploads the "post" to a specific country page the user have choosen
Database.database().reference().child("AlbaniaPosts").childByAutoId().setValue(postObject)
// this uploads the "post" to the users uid so all their posts will be shown at the profile page
Database.database().reference().child(uid!).childByAutoId().setValue(postObject)
And when they are saved in firebase they are saved as different childByAutoId so I was wondering if it is possible to save them all in the same childByAutoId ID.
So that if the user delete's a specific post then I can search for the AutoId they deleted and delete it from all countries and profile page and the global page, but I can't right now sense I upload the post in diffrent Id's
So if it is still hard to understand my question here is an image of my database
As you can see the posts are exactly the same, but they are saved in different AutoId's
Goal? My goal is to set the same id for the post when they are uploaded at all 3 locations.
help would be very much appreciated.
thanks for your time.
Yes you can do this. The problem is with how you are uploading the information. Get one key and reuse it. Like this:
let key = ref.child("posts").childByAutoId().key // use this key for all uploads
// this uploads the "post" to a global page
Database.database().reference().child("posts").child(key).setValue(postObject)
// this uploads the "post" to a specific country page the user have choosen
Database.database().reference().child("AlbaniaPosts").child(key).setValue(postObject)
// this uploads the "post" to the users uid so all their posts will be shown at the profile page
Database.database().reference().child(uid!).child(key).setValue(postObject)
Now all posts will be uploaded using the same key. I did childByAutoId() on "posts" but you can do it on any location. The reason you are getting different keys is because they are determined by the time you request them. Since you're requesting them at different times you're getting different keys.
Additionally, I think you might want to carefully think about how you want to access and modify data within your app. For example modifying one post requires editing the data in three separate locations. This problem could be solved by the use of cloud functions. Another option would be to just copy the "key" to things like "AlbaniaPosts", then you can query the keys for all posts under "AlbaniaPosts" you can use the keys to load the full post from "posts". You'd still need cloud functions to copy and delete the key around your database. Let me know if you have any questions.

Remove Facebook code query parameter [duplicate]

This question already has an answer here:
Removing the 'code' parameter from URL - Facebook connect PHP
(1 answer)
Closed 8 years ago.
I'm using Facebook authentification in my web app.
I have a URL of the type : https://www.facebook.com/dialog/oauth?client_id=123456789&redirect_uri=http://myapp.com/#story
It works really well but when the user is redirected to it, there's a query parameter that's added (for ex : http://myapp.com?code=AQCkHq--XXTngRCMgQxAAHExCaWzw5XYadd8vaVMytX91aPEc74oQWMBlyrr_HQUjBcC53sf_bREFz5cOBaFdgfvHSpWk1W0abbQA9ncbc0KQ0vyH6B1H37WXv1wcejblMQ6cTVLS98f4xvz-keiPgDJSh1v-Cyw-ACUFvAvs2yusHaSnfjITVZLDWQnNhBwpoELWFlJ75WAl0OrwD1_snZkQ2QQfL_5rcG2ZmpI9ORmFtFW-mrWEouA1zOiPSyTbP2d2LajGz82_KJuV5LBaFkULZ4mYSdALphPjvfwJkhrSQy7n_xKXGOfgr056bkqOIA#story;id=219012)
Is there a way to remove that long string from the URL?
It seems that when you add the response_type=token parameter, it's gone. ;-)