Caching images in ionic 4 - ionic4

I am working on ionic 4 app which includes swiping of images to left or right. Currently the images are fetched from the server every time which causes a delay in image loading. Could any one suggest an efficient way to cache or preload the images so as to increase the performance of the app by loading images from cache.

I think you have to use ionic-img-cache and it works with Ionic Framework (v >= 1.0) or 'ionic-cli' and see this also.
All links have an example. Run the first example here and another option is using LoadingController

use ion-media-cache this directive is to store image in the device.

Check this plugin it has the feature of caching image.
https://www.npmjs.com/package/ionic-image-loader

You Just use the tag it help to lazy load image attribute it's help t

Related

Show recently added record at top in vuejs

There is a image upload functionality in my vuejs application.
The image upload works good and the uploaded recorded is also displayed.
But this recently added record get displayed at last in my list. On page refresh it appears at top.
I want to show the recently uploaded image at top as soon as after successful upload.
I have been trying really hard for this since 2 days and couldn't find the solution.
Please help. Vuejs version is 2
basically if I'm correct what you want is to push new images to the images array, for this just use unshift()
something like this
this.images.unshift('url_or_info_of_the_new_image')
Here, you do have an example of code showing you how you could achieve this.
https://codesandbox.io/s/gracious-tree-nig54?file=/src/App.vue
Essentially, the most interesting part is this.initialArray = [this.newValue, ...this.initialArray].
Also, depends on what you've tried until now but keep in mind the few caveats JavaScript does have with VueJS v2: https://v2.vuejs.org/v2/guide/reactivity.html#For-Arrays

Image Detection for expo react native

I would like to include a feature in my app, where you can scan a certain picture and the app would recognise this image. Just like the image recognition feature in Viro: https://docs.viromedia.com/docs/ar-image-recognition . So I would set a certain image and it only needs to recognise this image.
I'm working with expo react native.
Does anybody have and idea how I might build this feature?
Thanks 😊
You can possibly just make it call a python service on the backend and pass it the image and get back the result for it.
If you want to go serverless, you can even get a premade AWS lamda function, which you can call and pass it the image, and it'll do the processing for you.
In the end, it's better if you do this kind of processing on the server side, your app could get locked up because image processing can take time and you don't want that to happen on a mobile app.

Images taking a while to load every time I start

Can anyone tell me why when I use my app, every boot up has a lag when loading my images and vector font icons? It probably only lags for a second, but it looks really bad.
It can't be the sizes of them because even the vector icons have about a second lag. Is there any way to prevent this
Would this have anything to do with it being connected to Expo?
You can resolve this by caching your assets while the app loading screen is still up: https://docs.expo.io/versions/latest/guides/preloading-and-caching-assets.html
Nevermind I found out it's an Expo thing. They strip all of the local images and put it in their cdn before building the app. Take note if you have an app in production using Expo

Preloading images in a Modal-component

I have a component which consists of a FlatList and a Modal-component. This modal component has several Image-components. The images are set by the source-attribute to an external url.
I switch die visibility of the modal-component by changing the visible attribute.
The problem:
Everytime I open the modal (at the beginning or after closing it) the images are loaded from the server. So there are no images for maybe 1 second.
Are the images deleted from the cache if I set the visible of the modal to false??
Caching of images can be related to multiple things. The most effective one is probably the Cache-Control header sent from the server when you request the image. You can check the headers to see if the request has a low time on cache.
The other thing is that, while development process, building or hot-reloading of the app can result in clearing the cache for the app.
Another reason can be the low storage in device might be triggering the OS to delete cached images.
In iOS you can control caching. More info can be find here.
Its hard to tell without any sample code but, if you are mounting and then unmounting Modal when you set the visibility of it, you can try to prefetch images before mounting the Modal. If the caching control is right when you mount the Modal they should be served from the cache. If the images you are trying to show are large it might be a performance issue or they might be taking long time to load from the disk. You can debug this with a less number of item in modal with smaller images.
Hope the information above is going to be enough.
you can use react-native-img-cache
or react-native-cached-image to cash your images
and yes the images in react native are not cached by default
also to preload images you can use react-native-fast-image

How to combine imageresizer responsive images with lazy load

I have implemented a lazy-load solution for images using http://www.appelsiini.net/projects/lazyload, and it works as expected.
Now that the DNN skin I'm working on is responsive, I want to make use of ImageResizer's responsive solution: http://imageresizing.net/blog/2013/effortless-responsive-images -- the setup is working right now, but when combined with lazy-load, the images that are served are no longer responsive.
Is there a way to combine these two technologies?
We run the latest .NET and IIS 7+. Thanks in advance!
Images added to the page after DOMLoaded will not be detected by Slimmage.js unless you call window.slimmage.checkResponsiveImages() . If you use a separate lazy-load or jQuery plugin that modifies images, call checkResponsiveImages() after it completes its work.
Browser vendors advise against lazy image loading, as it drains mobile device power. Turning on the wifi or LTE radio is the most expensive operation for a device, and lazy loading can make it 3-10x more chatty.