Add several ways to handle thumbnails. re #5

This commit is contained in:
Sébastien Lucas 2013-08-26 21:15:54 +02:00
parent b82bf8c19f
commit 13b16163d3
4 changed files with 17 additions and 4 deletions

View File

@ -632,6 +632,11 @@ function getJson ($complete = false) {
"use_fancyapps" => $config ["cops_use_fancyapps"],
"max_item_per_page" => $config['cops_max_item_per_page'],
"html_tag_filter" => $config['cops_html_tag_filter']));
if ($config['cops_thumbnail_handling'] == "1") {
$out ["const"]["url"]["thumbnailUrl"] = $out ["const"]["url"]["coverUrl"];
} else if (!empty ($config['cops_thumbnail_handling'])) {
$out ["const"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling'];
}
}
$out ["containsBook"] = 0;

View File

@ -202,9 +202,9 @@
* This configuration item allow to customize how thumbnail will be generated
* "" : Generate thumbnail (CPU hungry)
* "1" : always send the full size image (Network hungry)
* any url : Send a constant image as the thumbnail (you can try "images/bookcover.svg")
* any url : Send a constant image as the thumbnail (you can try "images/bookcover.png")
*/
$config['cops_thumbnail_handling'] = "images/bookcover.svg";
$config['cops_thumbnail_handling'] = "";
/*
* Contains a list of user agent for browsers not compatible with client side rendering

View File

@ -131,11 +131,19 @@ class Data extends Base {
$height = $config['cops_html_thumbnail_height'];
}
}
$urlParam = addURLParameter($urlParam, "height", $height);
if ($config['cops_thumbnail_handling'] != "1") {
$urlParam = addURLParameter($urlParam, "height", $height);
}
}
$urlParam = addURLParameter($urlParam, "id", $book->id);
if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB));
return new Link ("fetch.php?" . $urlParam, $mime, $rel, $title);
if ($config['cops_thumbnail_handling'] != "1" &&
!empty ($config['cops_thumbnail_handling']) &&
$rel == Link::OPDS_THUMBNAIL_TYPE) {
return new Link ($config['cops_thumbnail_handling'], $mime, $rel, $title);
} else {
return new Link ("fetch.php?" . $urlParam, $mime, $rel, $title);
}
}
else
{

BIN
images/bookcover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB