Updated logic to fetch images from local storage