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"], "use_fancyapps" => $config ["cops_use_fancyapps"],
"max_item_per_page" => $config['cops_max_item_per_page'], "max_item_per_page" => $config['cops_max_item_per_page'],
"html_tag_filter" => $config['cops_html_tag_filter'])); "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; $out ["containsBook"] = 0;

View file

@ -202,9 +202,9 @@
* This configuration item allow to customize how thumbnail will be generated * This configuration item allow to customize how thumbnail will be generated
* "" : Generate thumbnail (CPU hungry) * "" : Generate thumbnail (CPU hungry)
* "1" : always send the full size image (Network 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 * Contains a list of user agent for browsers not compatible with client side rendering

View file

@ -131,12 +131,20 @@ class Data extends Base {
$height = $config['cops_html_thumbnail_height']; $height = $config['cops_html_thumbnail_height'];
} }
} }
if ($config['cops_thumbnail_handling'] != "1") {
$urlParam = addURLParameter($urlParam, "height", $height); $urlParam = addURLParameter($urlParam, "height", $height);
} }
}
$urlParam = addURLParameter($urlParam, "id", $book->id); $urlParam = addURLParameter($urlParam, "id", $book->id);
if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB)); if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB));
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); return new Link ("fetch.php?" . $urlParam, $mime, $rel, $title);
} }
}
else else
{ {
return new Link (str_replace('%2F','/',rawurlencode ($book->path."/".$filename)), $mime, $rel, $title); return new Link (str_replace('%2F','/',rawurlencode ($book->path."/".$filename)), $mime, $rel, $title);

BIN
images/bookcover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB