Openlibrary: Lazy loaded images shouldnt ever display as broken thumbs

Created on 16 Nov 2018  路  8Comments  路  Source: internetarchive/openlibrary

Images in the carousel lazy load.

screenshot_20181115-171614_chrome

The slick library should have an option to set a placeholder.
Alternatively we should style img tag without a src attribute as plain background. Currently the loading of images appears a little broken.

UI Good First Issue Cover Service carousels help-wanted

Most helpful comment

Hi there. I can work on this.

All 8 comments

@jdlrobson Could you please clarify "broken thumb"? Do you mean as per the Darnden example above? That isn't exactly broken: it is the alt-text shown when no image is available. This is a normal situation if there is no access to the covers held at archive.org from the user's machine. I routinely see that from my work machine.

Sure. Maybe "broken thumb" was the wrong word to use here.
Essentially the problem as I see it, is it's very clear that these images are being loaded via JavaScript and the image should be loading progressively
lazyload

Compare that to this:
https://jsfiddle.net/solodev/sobtocgc/

which also uses slick and is much smoother.

So "broken" refers to the simultaneous loading? The fix would implement sequential loading?

the img tags should come preloaded with something like src="book_cover_placeholder.png", until they're actually loaded.

One solution to this is to probably have a dummy image show until a real image comes up.. Using something like

let image = image ? data.img : img.png;

A slick-loading class is present on img tags before they are loaded so this is what I propose:

.slick-loading {
    opacity: 0;
    background: white;
}

If we add a CSS animation for the opacity, this will be much better than the status quo!
Anyone want to work on this task?

Hi there. I can work on this.

I've got a branch for this fix 馃榾Can I be added as a contributor so I can submit a PR?

Edit: I was thinking I would push the fix branch to the open library remote, but I can fork and submit a PR from my fork. Will do this tonight.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cdrini picture cdrini  路  5Comments

cdrini picture cdrini  路  5Comments

nemobis picture nemobis  路  5Comments

BrittanyBunk picture BrittanyBunk  路  4Comments

Pratyush1197 picture Pratyush1197  路  3Comments