From 27989f140deeed0fa0bbd1f76fbc8ee13f4e3088 Mon Sep 17 00:00:00 2001 From: Joe Atzberger <ohiocore@gmail.com> Date: Fri, 12 Jul 2013 14:31:05 -0400 Subject: [PATCH] Booksite config and code for cover images --- config/vufind/config.ini | 6 +++--- module/VuFind/src/VuFind/Cover/Loader.php | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/config/vufind/config.ini b/config/vufind/config.ini index b2e3ac8523d..6cd00a689f9 100644 --- a/config/vufind/config.ini +++ b/config/vufind/config.ini @@ -357,7 +357,7 @@ major = studentmajor ; You can select Syndetics, LibraryThing, Summon, Amazon, Booksite, OpenLibrary, ; Contentcafe and/or Google Books. ; Note: Summon service takes a Serials Solutions client key, NOT Summon API key! -;coverimages = Syndetics:MySyndeticsId,Amazon:MyAccessKeyId,Booksite:MyCATSkey,LibraryThing:MyLibraryThingId,Google,OpenLibrary,Summon:MySerialsSolutionsClientKey,Contentcafe:MyContentCafeID +;coverimages = Syndetics:MySyndeticsId,Amazon:MyAccessKeyId,Booksite,LibraryThing:MyLibraryThingId,Google,OpenLibrary,Summon:MySerialsSolutionsClientKey,Contentcafe:MyContentCafeID ; This setting controls the image to display when no book cover is available. ; The path is relative to the base of your theme directory. @@ -368,7 +368,7 @@ noCoverAvailableImage = images/noCover2.gif ; Note: Guardian reviews contain embedded advertisements. If the API key is not ; supplied, e.g. "Guardian:", only the review title, byline, Guardian logo ; and a link to the full Guardian page will be displayed -;reviews = Syndetics:MySyndeticsId,SyndeticsPlus:MySyndeticsID,AmazonEditorial:MyAccessKeyId,Amazon:MyAccessKeyId,Booksite:MyCATSkey,Guardian:MyGuardianKeyId +;reviews = Syndetics:MySyndeticsId,SyndeticsPlus:MySyndeticsID,AmazonEditorial:MyAccessKeyId,Amazon:MyAccessKeyId,Booksite,Guardian:MyGuardianKeyId ; You can select from Syndetics or SyndeticsPlus ;excerpts = Syndetics:MySyndeticsId,SyndeticsPlus:MySyndeticsId @@ -895,4 +895,4 @@ max_tag_length = 64 ;Solr = Catalog ;Summon = Summon ;WorldCat = WorldCat -;SolrWeb = "Library Website" \ No newline at end of file +;SolrWeb = "Library Website" diff --git a/module/VuFind/src/VuFind/Cover/Loader.php b/module/VuFind/src/VuFind/Cover/Loader.php index 3f03e9cc237..6b9551223cd 100644 --- a/module/VuFind/src/VuFind/Cover/Loader.php +++ b/module/VuFind/src/VuFind/Cover/Loader.php @@ -479,6 +479,7 @@ class Loader implements \Zend\Log\LoggerAwareInterface return true; } else { + $this->debug("Failed to retrieve image from " + $url); return false; } } @@ -698,4 +699,24 @@ class Loader implements \Zend\Log\LoggerAwareInterface '/' . $isn . '/' . $this->size; return $this->processImageURL($url); } + + + public function booksite($id) + { + // convert normalized 10 char isn to 13 digits + $isn = $this->isn; + if (strlen($isn) != 13){ + $ISBN = new ISBN($isn); + $isn = $ISBN->get13(); + } + $url = isset($this->config->Booksite->url) ? + $this->config->Booksite->url : 'https://api.booksite.com'; + if (! isset($this->config->Booksite->key)) { + throw new \Exception("Booksite 'key' not set in VuFind config"); + } + $key = $this->config->Booksite->key; + $url = $url . '/poca/content_img?key=' . $key . '&ean=' . $isn; + return $this->processImageURL($url); + } + } -- GitLab