Bug 22445 - Ability to define a URL for custom cover images
Summary: Ability to define a URL for custom cover images
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords: Academy
Depends on:
Blocks:
 
Reported: 2019-03-01 22:54 UTC by Jonathan Druart
Modified: 2019-05-23 08:26 UTC (History)
6 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 22445: Add new prefs *CustomCoverImages* (6.60 KB, patch)
2019-03-01 23:11 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Add new method Koha::Biblio->custom_cover_image_url (1.19 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Add tests for Koha::Biblio->custom_cover_image_url (1.37 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Allow marc fields as pattern (2.73 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac shelfbrowser (3.19 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac results (2.58 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac detail (1.75 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac result (rss) (1.73 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac shelves (2.21 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac reviews (2.17 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac reviews (rss) (1.74 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac user (checkout list) (3.12 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - detail (staff) (2.69 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - search resulta (staff) (2.83 KB, patch)
2019-03-01 23:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - search resulta (staff) (2.95 KB, patch)
2019-03-06 20:25 UTC, Hayley Mapley
Details | Diff | Splinter Review
Bug 22455: (follow-up) Use CSS to set a max-width for images - OPAC (10.52 KB, patch)
2019-03-18 17:31 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 22455: (follow-up) Use CSS to set a max-width for images - Staff client (3.48 KB, patch)
2019-03-18 17:51 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 22445: Add new pattern %normalized_isbn% (3.24 KB, patch)
2019-04-05 01:34 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Add new prefs *CustomCoverImages* (6.60 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Add new method Koha::Biblio->custom_cover_image_url (1.19 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Add tests for Koha::Biblio->custom_cover_image_url (1.37 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Allow marc fields as pattern (2.73 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac shelfbrowser (3.19 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac results (2.58 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac detail (1.75 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac result (rss) (1.73 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac shelves (2.21 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac reviews (2.17 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac reviews (rss) (1.74 KB, patch)
2019-05-23 02:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac user (checkout list) (3.12 KB, patch)
2019-05-23 02:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - detail (staff) (2.98 KB, patch)
2019-05-23 02:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Custom cover images - search resulta (staff) (3.27 KB, patch)
2019-05-23 02:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: (follow-up) Use CSS to set a max-width for images - OPAC (10.51 KB, patch)
2019-05-23 02:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: (follow-up) Use CSS to set a max-width for images - Staff client (3.65 KB, patch)
2019-05-23 02:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Add new pattern %normalized_isbn% (3.24 KB, patch)
2019-05-23 02:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22445: Add new prefs *CustomCoverImages* (6.70 KB, patch)
2019-05-23 08:24 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Add new method Koha::Biblio->custom_cover_image_url (1.29 KB, patch)
2019-05-23 08:24 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Add tests for Koha::Biblio->custom_cover_image_url (1.47 KB, patch)
2019-05-23 08:24 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Allow marc fields as pattern (2.83 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac shelfbrowser (3.28 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac results (2.67 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac detail (1.84 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac result (rss) (1.83 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac shelves (2.31 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac reviews (2.27 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac reviews (rss) (1.83 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Custom cover images - opac user (checkout list) (3.22 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Custom cover images - detail (staff) (3.08 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Custom cover images - search resulta (staff) (3.37 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: (follow-up) Use CSS to set a max-width for images - OPAC (10.60 KB, patch)
2019-05-23 08:25 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: (follow-up) Use CSS to set a max-width for images - Staff client (3.74 KB, patch)
2019-05-23 08:26 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22445: Add new pattern %normalized_isbn% (3.34 KB, patch)
2019-05-23 08:26 UTC, Michal Denar
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2019-03-01 22:54:30 UTC
So far we have cover images from a list of webservices, COCE, locally, but we cannot define a custom url.
Comment 1 Jonathan Druart 2019-03-01 23:11:57 UTC
Created attachment 85925 [details] [review]
Bug 22445: Add new prefs *CustomCoverImages*

This patch set adds a new method to display cover images for
bibliographic records.
The idea is to provide a flexible way allowing several use cases:
- local path
- remote url
- webservice
which would follow a given pattern.

So far only the following patterns are available:
- %isbn% will be replaced byt the isbn of the record
- %issn%
- using MARC subfields:
  %024$a% to replace with the value in 024$a

For example
- /your/local/images/%isbn%.png
- https://covers.openlibrary.org/b/isbn/%isbn%-M.jpb
- etc.

There are 3 new sysprefs:
CustomCoverImagesURL
=> Define the path/url
CustomCoverImages
=> Turn on/off the display of the custom cover image in the staff client
OPACCustomCoverImages
=> Turn on/off the display of the custom cover image at the OPAC

Sponsored-by: Orex Digital
Comment 2 Jonathan Druart 2019-03-01 23:12:03 UTC
Created attachment 85926 [details] [review]
Bug 22445: Add new method Koha::Biblio->custom_cover_image_url

Sponsored-by: Orex Digital
Comment 3 Jonathan Druart 2019-03-01 23:12:07 UTC
Created attachment 85927 [details] [review]
Bug 22445: Add tests for Koha::Biblio->custom_cover_image_url

Sponsored-by: Orex Digital
Comment 4 Jonathan Druart 2019-03-01 23:12:11 UTC
Created attachment 85928 [details] [review]
Bug 22445: Allow marc fields as pattern

%tag$field%

There is a limitation here, only one replacement will work.
Let see if it is needed later to support several patterns

Sponsored-by: Orex Digital
Comment 5 Jonathan Druart 2019-03-01 23:12:14 UTC
Created attachment 85929 [details] [review]
Bug 22445: Custom cover images - opac shelfbrowser

Test plan:
Go to the detail page of a bibliographic record (at the OPAC)
and confirm the at custom cover images are displayed in the shelf
browser

Sponsored-by: Orex Digital
Comment 6 Jonathan Druart 2019-03-01 23:12:19 UTC
Created attachment 85930 [details] [review]
Bug 22445: Custom cover images - opac results

Test plan:
Search for bibliographic records at the OPAC, the custom cover should be
displayed

Sponsored-by: Orex Digital
Comment 7 Jonathan Druart 2019-03-01 23:12:23 UTC
Created attachment 85931 [details] [review]
Bug 22445: Custom cover images - opac detail

Test plan:
Go to the bibliographic record detail page at the OPAC, you should see
the custom cover image.

Sponsored-by: Orex Digital
Comment 8 Jonathan Druart 2019-03-01 23:12:27 UTC
Created attachment 85932 [details] [review]
Bug 22445: Custom cover images - opac result (rss)

This cannot be tested, it seems that the template is broken.

Sponsored-by: Orex Digital
Comment 9 Jonathan Druart 2019-03-01 23:12:31 UTC
Created attachment 85933 [details] [review]
Bug 22445: Custom cover images - opac shelves

Test plan:
Add a bibliographic record (that has a custom image) to a shelf,
view the shelf (OPAC).
You should see the image.

Sponsored-by: Orex Digital
Comment 10 Jonathan Druart 2019-03-01 23:12:35 UTC
Created attachment 85934 [details] [review]
Bug 22445: Custom cover images - opac reviews

Test plan:
- enable OpacShowRecentComments
- make a comment (OPAC)
- approve it (staff)
- click 'Recent comments' (OPAC)
=> You should see the custom cover

Sponsored-by: Orex Digital
Comment 11 Jonathan Druart 2019-03-01 23:12:41 UTC
Created attachment 85935 [details] [review]
Bug 22445: Custom cover images - opac reviews (rss)

Test plan:
Same as previous patch, then click on the feeds link

Sponsored-by: Orex Digital
Comment 12 Jonathan Druart 2019-03-01 23:12:44 UTC
Created attachment 85936 [details] [review]
Bug 22445: Custom cover images - opac user (checkout list)

Test plan:
- Check an item out to a patron
- At the OPAC loggin as this patron
On the checkout list you should see the cover image.

Sponsored-by: Orex Digital
Comment 13 Jonathan Druart 2019-03-01 23:12:48 UTC
Created attachment 85937 [details] [review]
Bug 22445: Custom cover images - detail (staff)

Test plan:
Staff side now, go the detail page of a bibliographic record
You should see the cover image.

Sponsored-by: Orex Digital
Comment 14 Jonathan Druart 2019-03-01 23:12:53 UTC
Created attachment 85938 [details] [review]
Bug 22445: Custom cover images - search resulta (staff)

Test plan:
Search for bibliographic records, the custom covers should be displayed.

Sponsored-by: Orex Digital
Comment 15 Hayley Mapley 2019-03-05 22:46:57 UTC
These patches don't seem to work fully as expected for me, as outlined below.

When clicking Edit on the bibliographic record details page and uploading a custom image, all test plans pass except for:
- OPAC reviews (Comment #11 rss - template is still broken it seems), 
- OPAC reviews (Comment #10 Recent Comments), 
- OPAC user (Comment #12 checkout list). 
In the case of the latter two scenarios, instead of displaying the image or the 'no cover image' placeholder image, a link that says 'Cover image' is displayed.

In terms of the url/local path options in the system prefs, is there anything that needs to be done apart from allowing display, setting the path/url and ensuring that the biblio has a url that is present in the path/url? I'm having trouble testing this (I'm pretty new)

Additionally, in most places where the cover image is displayed (such as the item detail page, etc.), the 'Cover image' link is also displayed underneath. I'm assuming this is a bug?
Comment 16 Katrin Fischer 2019-03-06 06:29:18 UTC
Hi Haley, 'Failed QA' is ok for getting answers to your questions. Thx for testing!
Comment 17 Jonathan Druart 2019-03-06 13:50:47 UTC
(In reply to Hayley Mapley from comment #15)
> These patches don't seem to work fully as expected for me, as outlined below.
> 
> When clicking Edit on the bibliographic record details page and uploading a
> custom image, all test plans pass except for:
> - OPAC reviews (Comment #11 rss - template is still broken it seems), 
> - OPAC reviews (Comment #10 Recent Comments), 
> - OPAC user (Comment #12 checkout list). 
> In the case of the latter two scenarios, instead of displaying the image or
> the 'no cover image' placeholder image, a link that says 'Cover image' is
> displayed.
> 
> In terms of the url/local path options in the system prefs, is there
> anything that needs to be done apart from allowing display, setting the
> path/url and ensuring that the biblio has a url that is present in the
> path/url? I'm having trouble testing this (I'm pretty new)
> 
> Additionally, in most places where the cover image is displayed (such as the
> item detail page, etc.), the 'Cover image' link is also displayed
> underneath. I'm assuming this is a bug?

Hello Hayley,
Did you fill CustomCoverImagesURL in? What value?
You are not supposed to attach an image to the record (this is the LocalCoverImages feature) neither add "an url to a biblio" (I did not understand that part in your comment).

To test easily you can use "https://covers.openlibrary.org/b/isbn/%isbn%-M.jpg"
(and not .jpb as written in the test plan, sorry it's a typo!)

Then the feature will behave the same as OpenLibraryCovers (it will pick the same covers).
Comment 18 Hayley Mapley 2019-03-06 20:22:47 UTC
(In reply to Jonathan Druart from comment #17)
> (In reply to Hayley Mapley from comment #15)
> > These patches don't seem to work fully as expected for me, as outlined below.
> > 
> > When clicking Edit on the bibliographic record details page and uploading a
> > custom image, all test plans pass except for:
> > - OPAC reviews (Comment #11 rss - template is still broken it seems), 
> > - OPAC reviews (Comment #10 Recent Comments), 
> > - OPAC user (Comment #12 checkout list). 
> > In the case of the latter two scenarios, instead of displaying the image or
> > the 'no cover image' placeholder image, a link that says 'Cover image' is
> > displayed.
> > 
> > In terms of the url/local path options in the system prefs, is there
> > anything that needs to be done apart from allowing display, setting the
> > path/url and ensuring that the biblio has a url that is present in the
> > path/url? I'm having trouble testing this (I'm pretty new)
> > 
> > Additionally, in most places where the cover image is displayed (such as the
> > item detail page, etc.), the 'Cover image' link is also displayed
> > underneath. I'm assuming this is a bug?
> 
> Hello Hayley,
> Did you fill CustomCoverImagesURL in? What value?
> You are not supposed to attach an image to the record (this is the
> LocalCoverImages feature) neither add "an url to a biblio" (I did not
> understand that part in your comment).
> 
> To test easily you can use
> "https://covers.openlibrary.org/b/isbn/%isbn%-M.jpg"
> (and not .jpb as written in the test plan, sorry it's a typo!)
> 
> Then the feature will behave the same as OpenLibraryCovers (it will pick the
> same covers).

Gah! As confusingly written as my comment was (and excluding the fact that I was mistakenly also testing the local cover images), I was simply missing the -M part of that URL which was stopping it from working.
Comment 19 Hayley Mapley 2019-03-06 20:25:18 UTC
Created attachment 86214 [details] [review]
Bug 22445: Custom cover images - search resulta (staff)

Test plan:
Search for bibliographic records, the custom covers should be displayed.

Sponsored-by: Orex Digital
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
All test plans pass using URL in CustomcoverImages syspref
Comment 20 Hugo Agud 2019-03-12 11:27:16 UTC
I have checked all test plan and it works fine, JUST the image size is the original image size, then if the thumbnail is bigger the image appear big... it can be fixed by css for sure.. but perhaps some kind of code limitation? 

it is just a suggestions
Comment 21 Jonathan Druart 2019-03-14 21:52:23 UTC
(In reply to Hugo Agud from comment #20)
> I have checked all test plan and it works fine, JUST the image size is the
> original image size, then if the thumbnail is bigger the image appear big...
> it can be fixed by css for sure.. but perhaps some kind of code limitation? 
> 
> it is just a suggestions

It seems that there is no homogeneity in the different image covers. At first glance it seems that the size is not taken into account for others either, except for adlibris.
We should deal with that problem globally, but on a separate bug report of course as it will complexity this patch set a lot.
Comment 22 Owen Leonard 2019-03-18 17:22:40 UTC
(In reply to Jonathan Druart from comment #21)

> We should deal with that problem globally, but on a separate bug report of
> course as it will complexity this patch set a lot.

All other cover image sources provide a generally-acceptable image size for all cover images. With local cover images, we provide the option for users to upload images but then we have Koha generate a thumbnail. For this feature to all any size image to be displayed is inconsistent with what we have now.

I'm going to submit patches to add classes to the display of cover images and add CSS to specify a maximum width for these covers.
Comment 23 Owen Leonard 2019-03-18 17:31:23 UTC
Created attachment 86726 [details] [review]
Bug 22455: (follow-up) Use CSS to set a max-width for images - OPAC

This patch adds some CSS and markup to OPAC templates so that custom
cover images have a maximum width of 140px (to match the width of
generated local cover image thumbnails). This prevents oversized images
from displaying inconsistently compared to images from other services.

To test, apply the patch and regenerate the OPAC CSS. Post an oversized
image which corresponds to a record in your OPAC which can be added to a
user's checkouts and to a list.

View the following pages to confirm that the image displays well:

 - OPAC search results
 - Bibliographic detail page
 - Shelf browser
 - List contents
 - Recent comments
 - "Your summary"
Comment 24 Owen Leonard 2019-03-18 17:51:05 UTC
Created attachment 86727 [details] [review]
Bug 22455: (follow-up) Use CSS to set a max-width for images - Staff client

This patch adds some CSS and markup to staff client templates so that
custom cover images have a maximum width of 140px (to match the width of
generated local cover image thumbnails). This prevents oversized images
from displaying inconsistently compared to images from other services.

This patch also adds a missing </a> to fix display problems.

To test, apply the patch and regenerate the staff client CSS. Post an
oversized image which corresponds to a record in your catalog.

View the following pages to confirm that the image displays well:

 - Catalog search results
 - Bibliographic detail page
Comment 25 Owen Leonard 2019-03-18 18:25:57 UTC
I have a concern which I think may be a blocker for this feature: All other cover image sources use a "normalized_isbn" variable which is provided to the templates. This feature doesn't use a normalized ISBN, so a library might upload an image file with a name like this:

"0553573403.png"

...and find that Koha is trying to load an image with this file name:

"0553573403 | 9780553573404 (pbk.).png"

I think it would be more consistent to have custom cover images use a normalized ISBN too.
Comment 26 Hugo Agud 2019-04-01 12:11:19 UTC
(In reply to Owen Leonard from comment #25)
> I have a concern which I think may be a blocker for this feature: All other
> cover image sources use a "normalized_isbn" variable which is provided to
> the templates. This feature doesn't use a normalized ISBN, so a library
> might upload an image file with a name like this:
> 
> "0553573403.png"
> 
> ...and find that Koha is trying to load an image with this file name:
> 
> "0553573403 | 9780553573404 (pbk.).png"
> 
> I think it would be more consistent to have custom cover images use a
> normalized ISBN too.

Not all books have ISBN for example historical books have not any kind of ISBN, even it should be great to be able to use non isbn and issn fields like 024.

I think force a normalized ISBN will reduce the potential value of it
Comment 27 Hugo Agud 2019-04-01 12:12:11 UTC
I have applied the patch, it appears the class Cover Image, but src is emtpy then no image is published
Comment 28 Owen Leonard 2019-04-01 12:42:02 UTC
(In reply to Hugo Agud from comment #26)

> > I think it would be more consistent to have custom cover images use a
> > normalized ISBN too.
> 
> Not all books have ISBN for example historical books have not any kind of
> ISBN

I'm not suggesting that the feature should be limited to only normalized ISBN. I'm saying that if ISBN is selected, normalized ISBN should be provided.
Comment 29 Jonathan Druart 2019-04-05 01:34:25 UTC
Created attachment 87434 [details] [review]
Bug 22445: Add new pattern %normalized_isbn%

Quite bad to use C4::Koha from Koha::Biblio :-/
Comment 30 Jonathan Druart 2019-04-05 01:35:23 UTC
(In reply to Owen Leonard from comment #28)
> I'm saying that if ISBN is selected, normalized ISBN should be
> provided.

Done, thanks for the follow-ups and the suggestion Owen!
Comment 31 Maria 2019-04-12 11:49:03 UTC
Tried to test. Test plan is divided into pieces and difficult to follow.

When we turned on the new sysprefs (CustomCoverImagesURL etc) the result was that we got a few images.

The images that were added in result list had a link to the image itself, not to the OPAC record. 

Would be good with new consolidated test plan.
Comment 32 Jonathan Druart 2019-04-24 02:03:14 UTC
(In reply to Maria from comment #31)
Hello Maria,

Thanks for testing this!

> Tried to test. Test plan is divided into pieces and difficult to follow.

Yes there is one test plan per patch. The goal is to tell what individual patch does.

> When we turned on the new sysprefs (CustomCoverImagesURL etc) the result was
> that we got a few images.

Noting is displayed if the cover does not exist, which isbn did you try?

> The images that were added in result list had a link to the image itself,
> not to the OPAC record. 

IIRC it is the behavior with other cover services.
Comment 33 Michal Denar 2019-05-22 19:15:46 UTC
Can you rebase this on master, please?

Thank you.
Comment 34 Jonathan Druart 2019-05-23 02:40:12 UTC
Created attachment 89973 [details] [review]
Bug 22445: Add new prefs *CustomCoverImages*

This patch set adds a new method to display cover images for
bibliographic records.
The idea is to provide a flexible way allowing several use cases:
- local path
- remote url
- webservice
which would follow a given pattern.

So far only the following patterns are available:
- %isbn% will be replaced byt the isbn of the record
- %issn%
- using MARC subfields:
  %024$a% to replace with the value in 024$a

For example
- /your/local/images/%isbn%.png
- https://covers.openlibrary.org/b/isbn/%isbn%-M.jpb
- etc.

There are 3 new sysprefs:
CustomCoverImagesURL
=> Define the path/url
CustomCoverImages
=> Turn on/off the display of the custom cover image in the staff client
OPACCustomCoverImages
=> Turn on/off the display of the custom cover image at the OPAC

Sponsored-by: Orex Digital
Comment 35 Jonathan Druart 2019-05-23 02:40:17 UTC
Created attachment 89974 [details] [review]
Bug 22445: Add new method Koha::Biblio->custom_cover_image_url

Sponsored-by: Orex Digital
Comment 36 Jonathan Druart 2019-05-23 02:40:22 UTC
Created attachment 89975 [details] [review]
Bug 22445: Add tests for Koha::Biblio->custom_cover_image_url

Sponsored-by: Orex Digital
Comment 37 Jonathan Druart 2019-05-23 02:40:26 UTC
Created attachment 89976 [details] [review]
Bug 22445: Allow marc fields as pattern

%tag$field%

There is a limitation here, only one replacement will work.
Let see if it is needed later to support several patterns

Sponsored-by: Orex Digital
Comment 38 Jonathan Druart 2019-05-23 02:40:30 UTC
Created attachment 89977 [details] [review]
Bug 22445: Custom cover images - opac shelfbrowser

Test plan:
Go to the detail page of a bibliographic record (at the OPAC)
and confirm the at custom cover images are displayed in the shelf
browser

Sponsored-by: Orex Digital
Comment 39 Jonathan Druart 2019-05-23 02:40:34 UTC
Created attachment 89978 [details] [review]
Bug 22445: Custom cover images - opac results

Test plan:
Search for bibliographic records at the OPAC, the custom cover should be
displayed

Sponsored-by: Orex Digital
Comment 40 Jonathan Druart 2019-05-23 02:40:39 UTC
Created attachment 89979 [details] [review]
Bug 22445: Custom cover images - opac detail

Test plan:
Go to the bibliographic record detail page at the OPAC, you should see
the custom cover image.

Sponsored-by: Orex Digital
Comment 41 Jonathan Druart 2019-05-23 02:40:43 UTC
Created attachment 89980 [details] [review]
Bug 22445: Custom cover images - opac result (rss)

This cannot be tested, it seems that the template is broken.

Sponsored-by: Orex Digital
Comment 42 Jonathan Druart 2019-05-23 02:40:48 UTC
Created attachment 89981 [details] [review]
Bug 22445: Custom cover images - opac shelves

Test plan:
Add a bibliographic record (that has a custom image) to a shelf,
view the shelf (OPAC).
You should see the image.

Sponsored-by: Orex Digital
Comment 43 Jonathan Druart 2019-05-23 02:40:52 UTC
Created attachment 89982 [details] [review]
Bug 22445: Custom cover images - opac reviews

Test plan:
- enable OpacShowRecentComments
- make a comment (OPAC)
- approve it (staff)
- click 'Recent comments' (OPAC)
=> You should see the custom cover

Sponsored-by: Orex Digital
Comment 44 Jonathan Druart 2019-05-23 02:40:57 UTC
Created attachment 89983 [details] [review]
Bug 22445: Custom cover images - opac reviews (rss)

Test plan:
Same as previous patch, then click on the feeds link

Sponsored-by: Orex Digital
Comment 45 Jonathan Druart 2019-05-23 02:41:01 UTC
Created attachment 89984 [details] [review]
Bug 22445: Custom cover images - opac user (checkout list)

Test plan:
- Check an item out to a patron
- At the OPAC loggin as this patron
On the checkout list you should see the cover image.

Sponsored-by: Orex Digital
Comment 46 Jonathan Druart 2019-05-23 02:41:06 UTC
Created attachment 89985 [details] [review]
Bug 22445: Custom cover images - detail (staff)

Test plan:
Staff side now, go the detail page of a bibliographic record
You should see the cover image.

Sponsored-by: Orex Digital
Comment 47 Jonathan Druart 2019-05-23 02:41:10 UTC
Created attachment 89986 [details] [review]
Bug 22445: Custom cover images - search resulta (staff)

Test plan:
Search for bibliographic records, the custom covers should be displayed.

Sponsored-by: Orex Digital
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
All test plans pass using URL in CustomcoverImages syspref
Comment 48 Jonathan Druart 2019-05-23 02:41:15 UTC
Created attachment 89987 [details] [review]
Bug 22445: (follow-up) Use CSS to set a max-width for images - OPAC

This patch adds some CSS and markup to OPAC templates so that custom
cover images have a maximum width of 140px (to match the width of
generated local cover image thumbnails). This prevents oversized images
from displaying inconsistently compared to images from other services.

To test, apply the patch and regenerate the OPAC CSS. Post an oversized
image which corresponds to a record in your OPAC which can be added to a
user's checkouts and to a list.

View the following pages to confirm that the image displays well:

 - OPAC search results
 - Bibliographic detail page
 - Shelf browser
 - List contents
 - Recent comments
 - "Your summary"
Comment 49 Jonathan Druart 2019-05-23 02:41:19 UTC
Created attachment 89988 [details] [review]
Bug 22445: (follow-up) Use CSS to set a max-width for images - Staff client

This patch adds some CSS and markup to staff client templates so that
custom cover images have a maximum width of 140px (to match the width of
generated local cover image thumbnails). This prevents oversized images
from displaying inconsistently compared to images from other services.

This patch also adds a missing </a> to fix display problems.

To test, apply the patch and regenerate the staff client CSS. Post an
oversized image which corresponds to a record in your catalog.

View the following pages to confirm that the image displays well:

 - Catalog search results
 - Bibliographic detail page
Comment 50 Jonathan Druart 2019-05-23 02:41:24 UTC
Created attachment 89989 [details] [review]
Bug 22445: Add new pattern %normalized_isbn%

Quite bad to use C4::Koha from Koha::Biblio :-/
Comment 51 Michal Denar 2019-05-23 08:24:50 UTC
Created attachment 89996 [details] [review]
Bug 22445: Add new prefs *CustomCoverImages*

This patch set adds a new method to display cover images for
bibliographic records.
The idea is to provide a flexible way allowing several use cases:
- local path
- remote url
- webservice
which would follow a given pattern.

So far only the following patterns are available:
- %isbn% will be replaced byt the isbn of the record
- %issn%
- using MARC subfields:
  %024$a% to replace with the value in 024$a

For example
- /your/local/images/%isbn%.png
- https://covers.openlibrary.org/b/isbn/%isbn%-M.jpb
- etc.

There are 3 new sysprefs:
CustomCoverImagesURL
=> Define the path/url
CustomCoverImages
=> Turn on/off the display of the custom cover image in the staff client
OPACCustomCoverImages
=> Turn on/off the display of the custom cover image at the OPAC

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 52 Michal Denar 2019-05-23 08:24:54 UTC
Created attachment 89997 [details] [review]
Bug 22445: Add new method Koha::Biblio->custom_cover_image_url

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 53 Michal Denar 2019-05-23 08:24:58 UTC
Created attachment 89998 [details] [review]
Bug 22445: Add tests for Koha::Biblio->custom_cover_image_url

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 54 Michal Denar 2019-05-23 08:25:02 UTC
Created attachment 89999 [details] [review]
Bug 22445: Allow marc fields as pattern

%tag$field%

There is a limitation here, only one replacement will work.
Let see if it is needed later to support several patterns

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 55 Michal Denar 2019-05-23 08:25:07 UTC
Created attachment 90000 [details] [review]
Bug 22445: Custom cover images - opac shelfbrowser

Test plan:
Go to the detail page of a bibliographic record (at the OPAC)
and confirm the at custom cover images are displayed in the shelf
browser

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 56 Michal Denar 2019-05-23 08:25:11 UTC
Created attachment 90001 [details] [review]
Bug 22445: Custom cover images - opac results

Test plan:
Search for bibliographic records at the OPAC, the custom cover should be
displayed

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 57 Michal Denar 2019-05-23 08:25:16 UTC
Created attachment 90002 [details] [review]
Bug 22445: Custom cover images - opac detail

Test plan:
Go to the bibliographic record detail page at the OPAC, you should see
the custom cover image.

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 58 Michal Denar 2019-05-23 08:25:20 UTC
Created attachment 90003 [details] [review]
Bug 22445: Custom cover images - opac result (rss)

This cannot be tested, it seems that the template is broken.

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 59 Michal Denar 2019-05-23 08:25:24 UTC
Created attachment 90004 [details] [review]
Bug 22445: Custom cover images - opac shelves

Test plan:
Add a bibliographic record (that has a custom image) to a shelf,
view the shelf (OPAC).
You should see the image.

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 60 Michal Denar 2019-05-23 08:25:29 UTC
Created attachment 90005 [details] [review]
Bug 22445: Custom cover images - opac reviews

Test plan:
- enable OpacShowRecentComments
- make a comment (OPAC)
- approve it (staff)
- click 'Recent comments' (OPAC)
=> You should see the custom cover

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 61 Michal Denar 2019-05-23 08:25:33 UTC
Created attachment 90006 [details] [review]
Bug 22445: Custom cover images - opac reviews (rss)

Test plan:
Same as previous patch, then click on the feeds link

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 62 Michal Denar 2019-05-23 08:25:37 UTC
Created attachment 90007 [details] [review]
Bug 22445: Custom cover images - opac user (checkout list)

Test plan:
- Check an item out to a patron
- At the OPAC loggin as this patron
On the checkout list you should see the cover image.

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 63 Michal Denar 2019-05-23 08:25:44 UTC
Created attachment 90009 [details] [review]
Bug 22445: Custom cover images - detail (staff)

Test plan:
Staff side now, go the detail page of a bibliographic record
You should see the cover image.

Sponsored-by: Orex Digital

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 64 Michal Denar 2019-05-23 08:25:48 UTC
Created attachment 90010 [details] [review]
Bug 22445: Custom cover images - search resulta (staff)

Test plan:
Search for bibliographic records, the custom covers should be displayed.

Sponsored-by: Orex Digital
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
All test plans pass using URL in CustomcoverImages syspref
Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 65 Michal Denar 2019-05-23 08:25:57 UTC
Created attachment 90011 [details] [review]
Bug 22445: (follow-up) Use CSS to set a max-width for images - OPAC

This patch adds some CSS and markup to OPAC templates so that custom
cover images have a maximum width of 140px (to match the width of
generated local cover image thumbnails). This prevents oversized images
from displaying inconsistently compared to images from other services.

To test, apply the patch and regenerate the OPAC CSS. Post an oversized
image which corresponds to a record in your OPAC which can be added to a
user's checkouts and to a list.

View the following pages to confirm that the image displays well:

 - OPAC search results
 - Bibliographic detail page
 - Shelf browser
 - List contents
 - Recent comments
 - "Your summary"

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 66 Michal Denar 2019-05-23 08:26:02 UTC
Created attachment 90012 [details] [review]
Bug 22445: (follow-up) Use CSS to set a max-width for images - Staff client

This patch adds some CSS and markup to staff client templates so that
custom cover images have a maximum width of 140px (to match the width of
generated local cover image thumbnails). This prevents oversized images
from displaying inconsistently compared to images from other services.

This patch also adds a missing </a> to fix display problems.

To test, apply the patch and regenerate the staff client CSS. Post an
oversized image which corresponds to a record in your catalog.

View the following pages to confirm that the image displays well:

 - Catalog search results
 - Bibliographic detail page

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 67 Michal Denar 2019-05-23 08:26:06 UTC
Created attachment 90013 [details] [review]
Bug 22445: Add new pattern %normalized_isbn%

Quite bad to use C4::Koha from Koha::Biblio :-/

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>