Covers from multiple sources RFC

==Existing sources for covers==
===Open, do not require a subscription===
====Amazon ( AmazonCoverImages )====
====Google ( GoogleJackets )====
* Google Books API Family
** Branding guidelines
====Local cover images ( OPACLocalCoverImages )====
====Open Library ( OpenLibraryCovers )====
* Open Library Covers API
====New Zealand National Library (Not Yet Implemented in Koha)====
* Accessing book cover images - a guide for libraries
** Note: use of this from outside New Zealand is not permitted.
===Closed, requires a subscription===
* Baker and Taylor 
* Novelist Select
* Syndetics
===Uncertain===
* Babelthèque (Can't see a field for username or similar?)
==Proposed Method==
This is to get the basics working, with an eye to improving things later.
Method:
# The page requiring an image requests a URL from Koha, e.g. opac-cover.pl?biblionumber=x
# That script looks in the cache[1] to see if it's seen a request for this before.
## If so: it proxies a request of the URL straight out, finishes.
## If not: it walks through the list of enabled cover services[2] checking each one to see if it can supply a cover
# If a service can provide the cover, it will proxy the request through and finish.
# If no cover can be found, a default 1x1 image will be supplied (see $noimage in C4::Images)
Notes:
# The cache will store what service successfully provided an image, it won't store the images themselves. It will use MySQL and possibly memcache.
# These services will be provided in a nice plugin type fashion to make it easy to add new ones.
==Work To Be Done==
* Implement Koha::CoverImages. This will:
** Load a set of modules for the available cover image services
** Take a biblio number and ask each module if it can supply an image URL for that
** When it finds one that can, it returns the URL.
** If it can't, it will return undef to indicate this.
** It will also have a method to output a 1x1 image to indicate that no cover was found.
* Implement Koha::Network. This will contain helper things related to networking. In this case:
** A method to aid in proxying a URL out as the result of a request. This will also allow browser caching headers to be set.
* Implement opac-covers.pl
** It will take a biblionumber and an option as to whether the image requested is a thumbnail
** Ask Koha::CoverImages for the URL
** If a URL was provided, use the method in Koha::Network to send the contents of the URL to the browser
** If undef was returned, output the 'no cover' image from Koha::CoverImages
* Implement catalogue/covers.pl which will be virtually identical to opac-covers.pl
* Implement modules for each of the services above. Each module will:
** Be able to determine if it can supply an image by looking at the sysprefs, and then querying the service if necessary.
** Provide a thumbnail form of the image as well as the full-size one
** Provide a URL to the image.
* Modify opac-detail, opac-results, opac-readingrecord, opac-user, opac-shelves, opac-showreviews, catalogue/detail, catalogue/results so that they use the new method instead of the old.
==Future Enhancements==
* Ordering of the sources - code for this is apparently coming in Bug 8726
* Returning HTML instead of an image, this can be pulled in with an iframe and will allow things like having the image clickable.
* Caching of images from services that allow that to happen.
* Providing a default "not found" image if nothing can be found.
==See also==
===Bugs===
* Bug 7187 - Prioritize cover image sources such as Amazon, Google and add fail over i.e. if first source fails, go to next
* Bug 9580 - Cover image from Coce, a remote image URL cache
===Misc===
* How to find a cover image for a book with an ISBN - links to other relevante posts
Category:OPAC_RFCs