Koken creates images by using image processing software installed on your web server. Every web host includes at least one image processing library for applications like Koken to use. Most users don't have to concern themselves with processing libraries, for Koken automatically selects and uses the best processor your host provides. Nonetheless, if you administer your own web server or are curious to learn more about how image processing in Koken works, read on.
Image generation and caching
A key part of Koken involves image generation and caching. This process takes your uploaded images and generates smaller versions for use inside Koken and on your public web site. A variety of image sizes are generated for optimum load times across all screen sizes (phones, tablets, desktops, etc). Once smaller versions of images have been cached, those cached versions are re-used for optimum speed and performance. A cached copy of an image is only generated again if you replace its original file with a new version.
Koken considers several factors when creating cached images, including the size the image will be displayed in your site theme and whether or not the end user is using a HiDPI (also known as "retina") screen. In all, Koken has the potential to create 28 different caches for each image you add to your library. That's a lot of images, and more than most shared web hosts can handle being requested all at once. To workaround that limitation, Koken creates most cached images on-demand as needed to avoid overloading your web server.
The four image processing libraries that Koken supports are listed below. At installation, Koken checks for them all in the following order then automatically selects the highest one.
GraphicsMagick is a tuned fork of ImageMagick (which Koken also supports). It works very well on resource-limited hosts as well as dedicated servers.
Imagick is a PHP extension that provides access to ImageMagick without needing exec(), shell_exec(), etc, to be available in PHP.
ImageMagick is popular and widely used. Many hosts have it pre-installed and it works well with Koken.
This library is included with PHP and is available on virtually all servers that Koken supports. While adequate, we only suggest using GD if the options above are unavailable or not functioning properly.
You can see which libraries are available on your server and assign a different one by visiting Settings > Image publishing inside Koken. If you have questions about your server's processing libraries, contact your host or system administrator. If you manage your own server, read on for optimization suggestions.
Advanced setup for server administrators
If you have installed Koken on your own (not shared) web server and are familiar with server administration, here are some tips for increasing image processing performance.
IMPORTANT: You should only follow these recommendations if you are a server administrator and have a powerful enough server to handle the workload. Performing any of the following steps on a shared host could result in a suspension of your hosting account and/or extra charges, depending on your provider.
Editing processor configuration
You may remove the default limitations that Koken imposes on all GraphicsMagick, ImageMagick and Imagick operations by adding the following lines to the very end of the
storage/configuration/user_setup.php file inside Koken's directory. On the right server, this can result in a 2x speed increase on most image proccessing tasks.
define('DARKROOM_MAGICK_THREADS', false); define('DARKROOM_MAGICK_MEMORY', false); define('DARKROOM_MAGICK_MAP', false);
If not already in-use, we recommend installing GraphicsMagick for optimum performance. GraphicsMagick is not typically installed by Linux, so you will need to consult the package manager for your Linux distribution for setup instructions. For example, to install GraphicsMagick on Ubuntu, you would do the following:
sudo apt-get update && sudo apt-get install graphicsmagick
You should then be able to select GraphicsMagick as your processor in Settings > Image publishing.
We hope by now you have a better understanding of how image publishing and caching in Koken works. Get in touch with your web hosting provider or server administrator for technical support with your server's processing libraries, or contact us with general questions if necessary.