Download the PHP package rokka/kirby without Composer
On this page you can find all versions of the php package rokka/kirby. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package kirby
Short Description Rokka plugin for Kirby CMS
License MIT
Homepage https://github.com/rokka-io/rokka-kirby-plugin
Informations about the package kirby
Kirby Rokka
rokka is digital image processing done right. Store, render and deliver images. Easy and blazingly fast. This plugin automatically uploads your pictures to rokka and delivers them in the right format, as light and as fast as possible. And you only pay what you use, no upfront and fixed costs.
Free account plans are available. Just install the plugin, register and use it.
WARNING
This is still beta software. We use this for our Liip company webpage, so it's somehow battle tested. But there's still room for improvements and some behind the scene code will change, the kirby API will stay stable, hopefully. And input is always welcome.
Requirements
- PHP 7.1
- Kirby 3.6+
- Rokka API key (free plan available).
- Rokka PHP Client 1.1+. Installed via composer, see below.
Installation
Composer install
The recommended way
Git Submodule
Copy and Paste
- Download the contents of this repository as ZIP-file.
- Rename the extracted folder to
rokka
and copy it into thesite/plugins/
directory in your Kirby project. composer require rokka/client
Usage
In your site/config.php
activate the plugin and set the ROKKA API key .
The following is also recommended for shorter, nicer image URLS (see below in "Defining Stacks"):
After having added that, you have to call https://yourkirbysite.com/_rokka/create-stacks
(and be logged in) to
create the actual stacks on the rokka server.
The plugin adds a $myFile->rokkaCropUrl($width, $height, $format = "jpg")
, $myFile->rokkaResizeUrl($width, $height, $format = "jpg")
and a $myFile->rokkaOriginalSizeUrl($format="jpg")
function to $file objects.
You can use them like the following in your templates:
There's also $myFile->rokka($stackname, $extension)
for returning an html img tag with using a stack and
$myFile->rokkaGetHash()
for getting the rokka hash of an image.
Defining stacks
Rokka has a concept of stacks, which allow to have nicer URLs.
You can configure some stacks with the rokka.kirby.stacks
configure option. If you for example use certain sizes a lot, you should use a stack. For example, if you do $myFile->rokkaCropUrl(200,200)
and $myFile->rokkaResizeUrl(300,300)
, then define a stack with
The value of the array (in this example www_thumbnail) is the used stack name. It can be an ascii text, you can use there whatever you want.
The noop
, crop
and resize
and raw
keys have a special meaning and you should define them like in the example above,
but you can change the name of the actual stacks
After you defined your stacks, open the URL https://yourkirbysite.com/_rokka/create-stacks
, after you logged in into the Panel.
This will create your stacks on the Rokka server. A panel option for this will come one day. You only have to do this
once, but whenever you change some of the stack definitions.
You can also set stack options for those stacks with eg.
And if you want different settings for retina screens you can add an 'options-retina' key
All available Stack options can be found on the rokka documentation.
Retina images
To be more documented.
Get html attribute snippets with
Rokka::getSrcAttributes($url)
Rokka::getBackgroundImageStyle($url)
for srcset
enabled tags with retina resolutions.
kirbytext
This plugin overwrites the kirbytext image
tag and serves pictures from rokka if that is used.
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.