Added placeholder image for unknown covers

This commit is contained in:
giomba 2018-12-22 17:30:51 +01:00
parent 4919486f10
commit 098c977d94
2 changed files with 9 additions and 2 deletions

View File

@ -69,8 +69,15 @@ class TPDF {
titleElement.appendChild(document.createTextNode(results['books'][i]['title']));
coverElement.src = 'output/images/' + results['books'][i]['cover'];
coverElement.alt = 'Cover of «' + results['books'][i]['title'] + '»';
if (results['books'][i]['cover'] != undefined) {
coverElement.src = 'output/images/' + results['books'][i]['cover'];
coverElement.alt = 'Cover of «' + results['books'][i]['title'] + '»';
}
else {
coverElement.src = 'frontend/placeholder.png';
coverElement.alt = '[no image]';
}
bookElement.appendChild(titleElement);
bookElement.appendChild(coverElement);

BIN
frontend/placeholder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB