how to: save image data to gallery [Flutter] - flutter

I have 1 question:
I use a library and it returns the Image data type, so how do I save or share the image in the library of my device?
code:
Image image = await HmsScanUtils.buildBitmap(request);

https://pub.dev/packages/gallery_saver
This plugin saves images and videos to gallery/photos.
You need to provide a path to the file that you want to save like below:
GallerySaver.saveImage(path)

You can use this package
https://pub.dev/packages/gallery_saver.
If you dont understand any documentation given on this page then you can simply follow the following tutorial by Johannes
https://www.youtube.com/watch?v=JILcQLZvjKE

Related

How to save image image with current location and some infos in FLutter

I want to save image taken in app with some information as current location(latitude, longtitude),around places(restaurant or something nearest place) ,some variables .this photo wil be shown in application in other page.At the moment i am saving image with rename file and get all infos from file name.Have any other method to save infos with image
AT the moment I am saving image as
/data/user/0/com.example.tflite_image_classification/cache/latidude#longtitude#aroundPlace.jpg
Can anyone have other stategy for save share please
If you are using the google map package, there is a method exists in the instance which is called takeSnapShot.
ex: mapController.takeSnapShot();

Path Provider Using and Asset Problems

I want to add an image that I added to my application from the phone's gallery to the list and call it with Image.asset as a String value.
I managed to get the image with ImagePicker. Unfortunately, there is no next. I don't know exactly how to do this.
In short: I will select an image from gallery with ImagePicker and replace it with "Image.file"
I will do it by converting it to String value with Image.asset.
You have to use image.file or image.memory to load an image from ImagePicker.
image.asset is for images that already exist within your app.

Is there a way to specify the file name in advance for the picture taken with the flutter camera plugin?

Hi I am using the flutter camera plugin and it works fine, the main issue I am having is that I can't find a way to tell the plugin the image file name when taking the picturee, in android using Kotlin this would be something like:
photoUri = FileProvider.getUriForFile(requireActivity(), "io.awesomedomain", photoFile) // build uri on the app storage space and specific file name -> photoFile.
captureImageIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri) // define the pic name before picture is actually taken by the camera.
startActivityForResult(captureImageIntent, REQUEST_PHOTO) // start the camera
I am currently just renaming the picture file name after the picture XFile returns from the flutter camera plugin but this doesn't feel optimal so I am wondering if I am missing something. Is it possible to specify the file name in advance to the flutter camera plugin?
I am currently using the latest available version at the moment: camera: ^0.7.0+2
OK, it looks like I had a misunderstanding of the Camera plugin, I noticed that the returned XFile places the picture in the cache directory and actually provides a method to save the picture to a more definitive storage xfile.saveTo so I did:
var appDir = appDocDirectory.parent.path; // get app directory
file.saveTo('$appDir${Platform.pathSeparator}files${Platform.pathSeparator}${weightPicture.pictureFileName}');
So the picture is properly saved under $myAppDir/files/picName.jpg where the files is a directory I configured to have permission to write to and the picName is defined by the application as I wanted.

How to get selected image's information from system photo using flutter

How to get selected image's information from system photo using flutter.
e.g.(longitudes,latitudes,photo time,Height,Width ...)
you can check out this library.
This will give all the information that you described.
photo_manager: ^0.4.6
https://pub.dev/packages/photo_manager

ANDROID : Loading Image From link stored in mysql db in imageview?

I want to load image in card view with other data like title and desc.
I am uaing php to get result as json response which is working and also i am able to set data to textview and pass from one activity to other !
Only problem i am facing is in setting image in image view.
i can add image manually by making listview obj and storing link in ArrayList obj
Like obj.add(R.drawable.feature1.jpg)
How to do it dynamically from the json response i am getting ?
Sorry if i sound confusing as i am new to android and just want to make a image gallery where first i will display list of albums and after clicking one of albums all images from that albums are loaded and displayed.
{"products":[{"mid":"1","title":"Demo Video 1","link":"https:\/\/m.youtube.com\/watch?v=PCwjNfSM-U","mediaCreatedOn":"2015-08-30 18:59:18","mediaUpdatedOn":"0000-00-00 00:00:00"},{"mid":"2","title":"Demo Video 1","link":"https:\/\/www.youtube.com\/","mediaCreatedOn":"2015-08-30 18:59:18","mediaUpdatedOn":"0000-00-00 00:00:00"}],"success":1}
The above is the output from server side where only the youtube link is replaced by server img location.
Thank you for reading, have a nice day ahead :)
1:You can store image to database Example:mysite.com/img/34324234342.png (phpMysql)
2:And you can get image from php rest service (Only image link)
3:For load image from link , you can use picasso library (android)
4:If you want image with text, you can use custom listview
Example xml for restful service.
<myimage>
<title>abc</title>
<ipath>mysite.com/img/34324234342.png</ipath>
</myimage>