Tech Blog

Customized Primo Brief Result Book Cover Image Loading

Primo, at the time of writing (version 4.6.4,), can load dynamically book cover images on brief result pages. But the function has two limitations:

1. Book cover images can be loaded only if the service providing website returns the images in a restrictive form containing ISBN, such as, http://syndetics.com/index.aspx?isbn=[ISBN]/SC.JPG&client=CLIENT. When a website provides book cover image service other than the way mentioned, Primo cannot entertain.

2. When a book cover image service provider returns problematic images, Primo doesn’t not have a mechanism to by-pass them. For example:

 

A consortial project of Hong Kong Self-financing institutes (http://www.csids.edu.hk/) wants to improve the situation. Codes in JSP and JavaScript were developed to cope with the above two problems; the source codes can be found here: https://github.com/HKSFILS/Primo-Enhancement. The codes do two functions:

1. Search over book images providing websites and parse book cover images’ URLs for displaying Primo brief result pages.

2. Filter undesired book cover images by comparing two images files using files digest calculation.

Description of the source codes:

1. tiles/bookcover_call_ajax.jsp:  being called by resultsTile.jsp and fullRecord.jsp for invoking the customized image fetching function.

2. tiles/bookcover_for_ajax.jsp:  being called by bookcover_call_ajax.jsp; for starting the image fetching process.

3. tiles/csids.jsp:  contains the functions (i.e. getCoverByISBN(), check[service provider]BCByISBN(), and computeCheckSumMD5()) used by the image fetching process.

The setup involves only modifying resultsTile.jsp and fullRecord.jsp to replace the default book cover image thumbnails with the calling of bookcover_call_ajax.jsp. Sample can be found at ouhk/tiles/resultsTile.jsp and ouhk/files/fullRecord.jsp.

Wai-yan NG (The Open University of Hong Kong, wwyng@ouhk.edu.hk)

Leave a Reply