| 0 |
Our Covers API provides a programmatic method to access the book covers and author photos available in the Open Library Covers Repository. |
0 |
Our Covers API provides a programmatic method to access the book covers and author photos available in the Open Library Covers Repository. |
| ... |
|
... |
|
| 11 |
|
11 |
|
| 12 |
Book covers can be accessed using Cover ID (internal cover ID), OLID (Open Library ID), ISBN, OCLC, LCCN and other identifiers like librarything and goodreads. |
12 |
Book covers can be accessed using Cover ID (internal cover ID), OLID (Open Library ID), ISBN, OCLC, and LCCN. |
| 13 |
|
13 |
|
| 14 |
The covers are available in 3 sizes: |
14 |
The covers are available in 3 sizes: |
| 15 |
|
15 |
|
| 16 |
1. <b>S</b>: Small, suitable for use as a thumbnail on a <a href="https://openlibrary.org/search?q=search+results">results page</a> on Open Library, |
16 |
1. <b>S</b>: Small, suitable for use as a thumbnail on a <a href="https://openlibrary.org/works/OL5734718W/Little_Brother#lists-section">lists section of a work</a> on Open Library, |
| 17 |
2. <b>M</b>: Medium, suitable for display on a <a href="https://openlibrary.org/books/OL5218962M">details page</a> on Open Library and, |
17 |
2. <b>M</b>: Medium, suitable for display on a <a href="https://openlibrary.org/books/OL5218962M">details page</a> on Open Library and, |
| ... |
|
... |
|
| 45 |
- https://covers.openlibrary.org/b/oclc/28419896-S.jpg |
45 |
- https://covers.openlibrary.org/b/oclc/28419896-S.jpg |
| 46 |
- https://covers.openlibrary.org/b/goodreads/979250-S.jpg |
|
|
| 47 |
- https://covers.openlibrary.org/b/librarything/192819-S.jpg |
|
|
| 48 |
|
48 |
|
| ... |
|
... |
|
| 65 |
<a name="rate-limiting"> </a> |
65 |
<a name="rate-limiting"> </a> |
|
|
64 |
|
|
|
65 |
<h2>Cover Size & API Access</h2> |
|
|
66 |
|
|
|
67 |
You can add `.json` to end end of cover urls to return API information about the cover, e.g. `https://covers.openlibrary.org/b/id/12547191.json`. |
|
|
68 |
|
|
|
69 |
One can fetch the image off-screen and use it's width/height: |
|
|
70 |
|
|
|
71 |
<pre> |
|
|
72 |
async function fetchImage(url) { |
|
|
73 |
const img = new Image(); |
|
|
74 |
return new Promise((res, rej) => { |
|
|
75 |
img.onload = () => res(img); |
|
|
76 |
img.onerror = e => rej(e); |
|
|
77 |
img.src = url; |
|
|
78 |
}); |
|
|
79 |
} |
|
|
80 |
|
|
|
81 |
const img = await fetchImage('https://covers.openlibrary.org/b/id/12547191-L.jpg'); |
|
|
82 |
const w = img.width; |
|
|
83 |
const h = img.height; |
|
|
84 |
</pre> |
|
|
85 |
|
|
|
86 |
This one way one won't need to make two separate requests per image! The browser won't make a second request for the image if you set the src of your visible `<img>` element after fetching it in this way. |
| 66 |
|
66 |
|
| ... |
|
... |
|
| 111 |
It has 4 columns ID-Name, ID-Value, OL-KEY and CoverID. |
111 |
It has 4 columns ID-Name, ID-Value, OL-KEY and CoverID. |
|