nitish24p / react-worker-image

React component to fetch image resources via web workers 🤖🤖
MIT License
232 stars 18 forks source link

Lazy Loading support of an Image #7

Open vihangpatel opened 6 years ago

vihangpatel commented 6 years ago

Fallback image if image loading fails.

nitish24p commented 6 years ago

What do you mean by if image loading fails.

  1. Incorrect url or
  2. The resource fetch fails..

In case of 1, if it fails due to incorrect url then a lazy load will also not be solving any problem. In case of 2, where image resource fails, i think we can add a catch block in the web worker script, and then use post message api.

vihangpatel commented 6 years ago

Fallback image was another enhancement suggested.

In either case, fallback image should be displayed. For an e.g. Fetching movie poster, if URL incorrect/resource fetch failed, there should be default fallback image which kind of depicts the poster is for movie category.

nitish24p commented 6 years ago

How will this be diff from placeholder

manjula-dube commented 6 years ago

@nitish24p I suppose what is trying to tell is placeholder is image tag right? this will a fallback image incase we do not find that image src.

Meaning a default one

nitish24p commented 6 years ago

Ahh okay.. got it.. cool makes sense.. :) So this is also something which can be taken as a prop.. so its customisable

nitish24p commented 6 years ago

@vihangpatel you can make a PR for this if you want.. 👍