From 13b16163d340b1f3199281a16b1d6bdfb62c6296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 26 Aug 2013 21:15:54 +0200 Subject: [PATCH] Add several ways to handle thumbnails. re #5 --- book.php | 5 +++++ config_default.php | 4 ++-- data.php | 12 ++++++++++-- images/bookcover.png | Bin 0 -> 3057 bytes 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 images/bookcover.png diff --git a/book.php b/book.php index 346e1b0..9c34cbc 100644 --- a/book.php +++ b/book.php @@ -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; diff --git a/config_default.php b/config_default.php index ff36d3e..b56f6a1 100644 --- a/config_default.php +++ b/config_default.php @@ -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 diff --git a/data.php b/data.php index 2c2c019..4866d45 100644 --- a/data.php +++ b/data.php @@ -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 { diff --git a/images/bookcover.png b/images/bookcover.png new file mode 100644 index 0000000000000000000000000000000000000000..6c3c8c743ca0c53cf2eb0888e09fa0488d6cbc11 GIT binary patch literal 3057 zcmV004R> z004l5008;`004mK004C`008P>0026e000+ooVrmw00004XF*Lt006O$eEU(800001 zb5ch_0Itp)=>Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01m_e01m_fl`9S#000X} zNkl-8}?vlpE8JG-&?yP4w0J?HE@XDgi53c>b3cP-)HuI_Bi*~iW%AxJs3gxQtw5A~U|A!nV?Oi-3O+u-c1vjzltZJu+s9a@P7zvc`UuRjwZKd3X&C-zln zq!Ll`th5Az{6D*}FsTe)G=3WL_fJib%bcx(E-IzZ+0zhYlWow0nSSWWU66~57i&;G z3#sY%&03Hz5&VsoxG!fx_F!~0`97bmAcwHBHb-yHg2ZCR9t(06j0L5b&QXxO zh}nt0H_3$@1<4`8KJ>jwe#}jfE2)`80c>(QCqZ%o#YY6cqg5_bGx<3SL9z%x2(^j> zUKpi7r4AMa$ywmb(C4N(8S28;1UW#>k_2EE9vP43B1nvkX-wBsxd?I^{hjZ0O$Jx7 z=OcX%J9YO`grcR2;rRb-iLft@{ABStIZ$`@JNZe5m@z_E>_smch|NMWPiYGk5fQ*g<&4@be*FlkIrxo!WYyG0VgfUdjekjK!##m?C~K# zu4v2a0M29mo|FkP)&#j6)3wRzdUi)NDZT$$6YMEQ%bwH($vkFU5CYZ zNzwk+tNzTR<)@N|!;&DM2zc#t8H$lt)^~Zj)~OPUQ@VyIH>D!T1%Vedxxv%pd*rWD zQY5x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