When you request a book cover image from Amazon which doesn't exist, the response isn't a 404 but a single-pixel GIF. This page describes ways in which developers can use this to have display of Amazon covers gracefully degrade:
We use the client-side technique in Koha. I wonder if we couldn't do the same thing with the local covers? The hex dump of a single-pixel gif is tiny:
4749 4638 3961 0100 0100 8000 00ff ffff
0000 0021 f904 0100 0000 002c 0000 0000
0100 0100 0002 0244 0100 3b
Could that be converted to binary and returned in place of an error? For instance, line 103 of opac-image.pl, "warn "No image exists for $imagenumber" if $DEBUG;"
I'm guessing this would speed up loading the page since the browser spends a lot of time looking for cover images which don't exist.
Created attachment 8068 [details] [review]
Bug 7600: Return a single-pixel GIF when no local cover image exists
Created attachment 8254 [details] [review]
The test of the proposed patch was successful in that the 404 error message is not shown anymore (in Firefox 10 it could only be seen in the "Net" tab in Firebug after a reload of the page).
The patch adds a tiny gif image and the placeholder "No cover image available" is not displayed. I saw that as a good sign to avoid too much information that doesn't really help the user.
Falling back to a 1 pixel gif seems pretty safe, and it's well implemented here. This also opens the door for other default 'noimage' images down the road, should it ever come up.
* local cover is a 3.8 ENH, so setting version accordingly
* C4/Image.pm has 2 perlcritic failure before the patch, one after, good job ;-)