ImageKit - An Asynchronous Thumbs API

I tested optimizers again and came across a similar issue. It seems that the problem is caused by the intermediate file format used. Explanation: When the ImageMagick driver is active, ImageKit currently uses PNM and TGA as intermediate file formats between imagemagick and the optimizers. As the optimizer takes care of image compression, there is no need to encode the image twice as JPEG (loss of image quality) or PNG (encoding large images is very expensive). But it seems, that support for these formats is not always available for these optimizers, depending on system setup und and how they where built (at least that is my only explanation, because in earlier tests I tried different intermediate formats on different images and everything worked fine with the file formats used in the final version).

The optimizers found in site/plugins/imagekit/lib/optimizer mostly call an internal method called $this->getTemporaryFilename('tga') or $this->getTemporaryFilename('pnm') Try to change this to $this->getTemporaryFilename('jpg') (mozjpeg, jpegtran) and $this->getTemporaryFilename('png') (pngquant, optipng).

If it still fails, we have to look somewhere else.

For anyone who wants to use mozjpeg with ImageKit on the newer uberspace 7 server: As the toast package manager is not supported anymore and thus only installed on the older uberspace 6 server, someone from uberspace gave me instructions to install mozjpeg with linuxbrew:

$ git clone https://github.com/Linuxbrew/brew.git ~/.linuxbrew 
$ echo "PATH=\"$HOME/.linuxbrew/bin:\$PATH\"" >> ~/.bashrc 
$ echo "MANPATH=\":$HOME/.linuxbrew/share/man:\$MANPATH\"" >> ~/.bashrc 
$ echo "INFOPATH=\"$HOME/.linuxbrew/share/info:\$INFOPATH\"" >> ~/.bashrc 
$ echo "HOMEBREW_BUILD_FROM_SOURCE=1" >> ~/.bashrc && source ~/.bashrc
$ brew install mozjpeg

The path to cjpeg:
~/.linuxbrew/Cellar/mozjpeg/3.3.1/bin/cjpeg

(A few hours ago brew install mozjpeg gave errors because gcc didn’t install correctly, but they just fixed it)

3 Likes