[Koha] dual cover images suport

David Nind david.nind at gmail.com
Sun Aug 2 10:18:33 NZST 2020


Hi Alvaro.

Some options I have used to reduce png size (not for Koha cover images
though):

- https://tinypng.com/ Does a great job of reducing image size (either one
off or smaller batches)

- pngcrush: a command line program for reducing png size

Some resources for pngcrush:
- command I have used: pngcrush -rem alla -nofilecheck -reduce -m 7 -d
"/dest/i/ation/folder/" *.png
- some resources:
  . https://zoompf.com/blog/2014/11/png-optimization
  .
http://linuxpoison.blogspot.co.nz/2010/01/pngcrush-optimize-png-file-image-to.html
(css not working, but still readable)
  . https://gist.github.com/tony-landis/3909387 (Script to go through
folder and minimise images using pngcrush)

As always, test on a non-production system and keep a backup until you are
happy with the results.

When I tested using pngcrush a few years ago (2018) for the manual, it
reduced the image folder size from 82.3 MB to 54.6 MB - about a 33%
reduction in size.

David Nind | david.nind at gmail.com
PO Box 12367, Thorndon, Wellington, New Zealand 6144
m. +64 21 0537 847


On Sun, 2 Aug 2020 at 06:13, Alvaro Cornejo <cornejo.alvaro at gmail.com>
wrote:

> Hi
>
> We have seen that the cover images we have been loading into koha, in png
> format, are quite big (some over 1Mb) so we are checking a way to optimise
> their size.
>
> One option is to replace those png files with one with a lower
> resolution/size keeping the same png format and/or move to jpeg.
>
> Another option would be to convert them to a better image format like webp.
> The issue here is that that webp is not supported by some browsers.
> Therefore, we need to have two cover image versions.
>
> In this last case, we will either need to add a second image column in
> mysql for the optimized version or store them somewhere in the network. In
> addition to that, we will need to modify opac-image.pl or create another
> get-webp-cover.pl script in order to have something like:
>
> <picture>
>   <source type="image/webp" srcset="/get-webp-cover.pl?biblionumber=243233
> ">
>    <img style="-webkit-user-select: none;margin: auto;cursor: zoom-in;"
> src="
>
> https://biblioteca.celacp.org/cgi-bin/koha/opac-image.pl?biblionumber=243233
> "
>
> width="445" height="695">
> </picture>
>
> Instead of just
> <img style="-webkit-user-select: none;margin: auto;cursor: zoom-in;"
> src="
>
> https://biblioteca.celacp.org/cgi-bin/koha/opac-image.pl?biblionumber=243233
> "
>
> width="445" height="695">
>
> And  /get-webp-cover.pl will return
>   <img style="-webkit-user-select: none;margin: auto;cursor: zoom-in;"
> src="/image/ 243233.webp" width="445" height="695">
>
> Will adding an additional column to mysql break future koha upgrades?
> opac-image.pl modifications for sure will be overwritten in future
> uogrades, so we will need to keep track of changes and reapply them after
> each upgrade.
>
> Any thoughts on the best way to go?
>
> Regards,
>
> Alvaro
>
>
>
> |----------------------------------------------------------------------------------------|
>  Stay safe / Cuídate/  Reste sécurisé
> *7* Switch off as you go / Apaga lo que no usas /  Débranchez au fur et à
> mesure.
>  *q *Recycle always / Recicla siempre / Recyclez toujours
>  P Print only if absolutely necessary / Imprime solo si es necesario /
> Imprimez seulement si nécessaire
> _______________________________________________
>
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>


More information about the Koha mailing list