Kirby 3 Thumb Driver using Imageoptim

1.3.3 2019-07-18 14:18 UTC


GitHub release License Kirby Version Kirby 3 Pluginkit

Kirby 3 CMS Thumb Component to optimize images using ImageOptim Api.

Commerical Usage

This plugin is free but if you use it in a commercial project please consider to


  • unzip as folder site/plugins/kirby3-thumb-imageoptim or
  • git submodule add site/plugins/kirby3-thumb-imageoptim or
  • composer require bnomei/kirby3-thumb-imageoptim



In your site/config.php options set the ImageOptim API key.

'options' => [
    'bnomei.thumbimageoptim.apikey' => 'YOUR_API_KEY_HERE',
    // ... other options

Generate thumbs as usual using resize() File Method.

$img = $page->image('ukulele.jpg');
echo $img->resize(234)->html();

TIP: If you want your image to be optimized but retain their original size use: $img->resize() without providing a width or height.



  • default: null – your imageoptim apikey as string

TIP: you can also set a callback if you use the dotenv Plugin 'bnomei.thumbimageoptim.apikey' => function() { return env('IMAGEOPTIM_APIKEY'); },


  • default: true
  • set to false to disable optimization with this plugin


  • default: false
  • set to true when images are not public available (like a website with htpasswd).

DANGER: Content is always uploaded on localhost. allow_url_fopen PHP setting must be enabled for the API to do uploading. Check with ini_get('allow_url_fopen'). Please be aware of the potential security risks caused by allow_url_fopen!


This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.



It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.