Covers from multiple sources RFC

From Koha Wiki
Jump to navigation Jump to search

Existing sources for covers

Open, do not require a subscription

Amazon ( AmazonCoverImages )

Google ( GoogleJackets )

Local cover images ( OPACLocalCoverImages )

Open Library ( OpenLibraryCovers )

New Zealand National Library (Not Yet Implemented in Koha)

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:

  1. The page requiring an image requests a URL from Koha, e.g. opac-cover.pl?biblionumber=x
  2. That script looks in the cache[1] to see if it's seen a request for this before.
    1. If so: it proxies a request of the URL straight out, finishes.
    2. If not: it walks through the list of enabled cover services[2] checking each one to see if it can supply a cover
  3. If a service can provide the cover, it will proxy the request through and finish.
  4. If no cover can be found, a default 1x1 image will be supplied (see $noimage in C4::Images)

Notes:

  1. The cache will store what service successfully provided an image, it won't store the images themselves. It will use MySQL and possibly memcache.
  2. 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

Misc