bnomei/kirby3-thumb-imageoptim

Kirby 3 Thumb Driver using Imageoptim

1.3.1 2019-02-06 13:08 UTC

README

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

Installation

  • unzip master.zip as folder site/plugins/kirby3-thumb-imageoptim or
  • git submodule add https://github.com/bnomei/kirby3-thumb-imageoptim.git site/plugins/kirby3-thumb-imageoptim or
  • composer require bnomei/kirby3-thumb-imageoptim

Requirements

Setup

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.

Settings

apikey

  • 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'); },

bnomei.thumbimageoptim.optimize

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

bnomei.thumbimageoptim.forceupload

  • 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!

Disclaimer

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.

License

MIT

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.