How to save image image with current location and some infos in FLutter - 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();

Related

how to: save image data to gallery [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

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.

Flutter - Cache_network_image. I replaced old image with new image with same name. But it doesn't affect on app

I am new to flutter. I have used library of "cache_network_image" which help to show images from the internet and keep them in the cache directory. In first load, it download the images and stored in cache directory(cache manager) and displayed in app.
Example. I have an image(test.png), it downloaded from network and stored in cache successfully. But If I replace test.png image with new image with same name of test.png. So It should display new image
with that same name(test.png). It's displaying only old image.
The cache_network_image library not working properly. Please share your thoughts.
no, it doesn't care whats in the end of the url, all it cares is whether file exists locally, if it doesn't then only it'll fetch from the url, if you want to refetch the updated image you have clear the cache, delete the app data or if you want to clear programmatically
var cm = DefaultCacheManager();
cm.emptyCache();

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>

How to handle correctly converting images to thumbnails

I'm building out an admin area for an ecommerce site where the user can create a new product and upload multiple images to be used for the product. I have a table that lists all of the products, each row shows the first image returned from the database. I can scale down a large image to 100px x 100px but the user is still downloading a big image, not a true thumbnail.
I see two ways of doing this:
1. I can make the user choose which img will be the thumbnail so that the regular img is upload and also a smaller version of the file.
2.I can create thumbnails for every img that is uploaded and append to the filename of the thumbnail img so that I can return the first image that ends with a certain string.
Is there a more elegant way to do this or am I on the right track?
Create a cache directory, then create a script called something like image.php. Link your images like this
<img src="image.php?path=images/img.png&width=100&height=100">
Then in image.php, it should first check in the cache directory if the file exists.
Call the file "img.png&width=100&height=100" and save it in the cache directory. That way you can easily check if it exists, but there is enough entropy for someone to change it to width=101 and height = 101 so that the image will be regenerated.
Each time you create the thumbnail, just store it in the cache directory. If it exists, do a header() call and an echo file_get_contents() and then die().