Mozzo1000 / booklogr

A simple, self-hosted service to keep track of your personal library 📚
https://demo.booklogr.app
Apache License 2.0
162 stars 1 forks source link

Placeholder cover image when no can be found #4

Closed Mozzo1000 closed 2 months ago

Mozzo1000 commented 2 months ago

If there does not exist a cover image for a book. The book card should still display something in it's place instead of an empty container

Screenshot 2024-07-15 at 12-30-55 BookLogr

Mozzo1000 commented 2 months ago

We naively retrieve a cover image from https://covers.openlibrary.org with the books isbn. https://covers.openlibrary.org/b/isbn/0241624126-L.jpg OpenLibrary apparently returns a 200 with a 1x1 white image even thought it can't find a cover for this particular isbn.

Mozzo1000 commented 2 months ago

According to the documentation we can append ?default=false to make requests for covers return a 404 if not found.

By default it returns a blank image if the cover cannot be found. If you append ?default=false to the end of the URL, then it returns a 404 instead. 

https://openlibrary.org/dev/docs/api/covers