I'm busy playing around with updating to the nice new bootstrap theme. We use google jackets most of the time, but have some localcovers stored too. I want to style the localcover imgs the same as any other bookmark. Ideally, they need a thumbnail class. But the 1px image that is returned causes (potentially, at least in my case) things like empty borders. Could the Locacovers.js function be modified to a) include a class of thumbnail for the image b) not insert the image when it is 1px in size. The following function would do that... /** * Search all: * <div title="biblionumber" id="isbn" class="openlibrary-thumbnail"></div> * or * <div title="biblionumber" id="isbn" class="openlibrary-thumbnail-preview"></div> * and run a search with all collected isbns to Open Library Book Search. * The result is asynchronously returned by OpenLibrary and catched by * olCallBack(). */ GetCoverFromBibnumber: function(uselink) { $("div[id^=local-thumbnail],span[id^=local-thumbnail]").each(function(i) { var mydiv = this; var message = document.createElement("span"); $(message).attr("class","no-image"); $(message).html(NO_LOCAL_JACKET); $(mydiv).append(message); var img = $("<img />").attr('src', '/cgi-bin/koha/opac-image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class")) .load(function () { this.setAttribute("class", "thumbnail"); if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { //IE HACK try { $(mydiv).append(img); $(mydiv).children('.no-image').remove(); } catch(err){ }; } else if (this.width > 1) { // don't show the silly 1px "no image" img if (uselink) { var a = $("<a />").attr('href', '/cgi-bin/koha/opac-imageviewer.pl?biblionumber=' + $(mydiv).attr("class")); $(a).append(img); $(mydiv).empty().append(a); } else { $(mydiv).empty().append(img); } $(mydiv).children('.no-image').remove(); } }) }); }
Created attachment 28270 [details] [review] Add a class to local thumbnails and don't show 1px no-image-found
Created attachment 45347 [details] [review] [SIGNED-OFF]BUG 11602: [ENH] Fix localcover display Adds a css class of thumbnail to local covers Don't show the 1px "No image found" image (since we'll ususally try another image provider) Add a class to local thumbnails and don't show 1px no-image-found Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Box with "No cover image availabe" fixed when syspref OPACLocalCoverImages set to display
Created attachment 45364 [details] [review] [PASSED QA] BUG 11602: [ENH] Fix localcover display Adds a css class of thumbnail to local covers. Don't show the 1px "No image found" image (since we'll ususally try another image provider) Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Box with "No cover image availabe" fixed when syspref OPACLocalCoverImages set to display Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
I see 2 sides on this: - It makes local covers behave more like the other cover services, showing the standard 'no-image'. (consistency) - It means a change to existing installations, but the newly showing image can be easily hidden with CSS... so not sure this should stop this.
Patch pushed to master. Thanks Nicholas!
Patch pushed to 3.22.x, will be in 3.22.1
This patch has been pushed to 3.20.x, will be in 3.20.7.
Thanks everyone - great to have contributed to Koha! :-)