How to add a fallback image from local machine when the image from the server is not available or down

Hello! I am using strapiV4 with nextjs/ typescript. All works fine. But I got a problem while adding a fallback image from local machine in case the strapi image fails or the server downs. I will appreciate any help, huge thanks.