Skip to content
Kirby 3 CMS Thumb Component to optimize images using ImageOptim Api
Branch: master
Clone or download
bnomei apikey as callback
Signed-off-by: Bruno Meilick <b@bnomei.com>
Latest commit aa9cb37 Feb 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
classes
vendor
.editorconfig
.gitignore
.php_cs.dist kirby3 rc-2 Dec 22, 2018
composer.json apikey as callback Feb 6, 2019
composer.lock
index.php pluginkit, apikey can be callback Feb 6, 2019
readme.md pluginkit, apikey can be callback Feb 6, 2019

readme.md

Kirby 3 Thumb Imageoptim

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.

You can’t perform that action at this time.