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

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();

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();

Old cached image displays after clear local cache, want to display newly downloaded image from network

In my app I download an image from the network then save this image in local cache storage with a specific name such as test.jpeg, then I display the test.jpeg image in Android device.
If I clear local cache for the app in android settings, then again download new image from network and save the new image with the same name (test.jpeg). Then I display the image, I expect the new image should be displayed but it displayed the old image.
After killing the app and running it again then it displays the new image.
To download and save the image I use Dio library.
Here is sample code of download and save to local directory
Dio client;
String imageSavePath =
path.join((await getTemporaryDirectory()).path, “test.jpeg”);
await client.download(url, imageSavePath);
So, how can I display newly downloaded image without closing the app.
Please check below link https://api.flutter.dev/flutter/painting/imageCache.html
import 'package:flutter/services.dart';
imageCache.clear();
It might works for you.

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>

CQ5 DAM asset: Not able to create thumbnail at renditions tab

When I upload an image to the DAM and generate renditions, I sometimes find that rendition's thumbnail is not able to be created.
I tried to take a look at http://localhost:4502/etc/workflow/models/dam/update_asset.html but I don't know which step generate the rendition's thumbnails. Is it possible to fix this?
The "Thumbnail creation" process step (part of the http://localhost:4502/cf#/etc/workflow/models/dam/update_asset.html) creates the thumbnail renditions of the uploaded Digital asset in DAM.
Its common to see that the original document does not have a thumbnail displayed in the DAM renditions console. As long as you are able to open up and view the original version of the document and the renditions in their respective consoles in DAM, I think you are good to go!
If you click on the original rendition, the file will open without any issue.
In order to avoid long loading times, if the image is more than 300KB of size then the document icon is shown instead of a full image in case of original rendition. Try uploading a file of less than 300KB in size and you can see the thumbnail in case of original rendition as well.
The rendition is getting generated fine, it is just not displayed on the UI. AEM 6 will be touch UI enabled and in the new UI, you will be able to see the rendition for "original" image as well.

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().