Skip to content

Latest commit

 

History

History
47 lines (29 loc) · 1.75 KB

image.md

File metadata and controls

47 lines (29 loc) · 1.75 KB

Image

Image manipulation

Kirby is based on SimpleImage. It means that you can use SimpleImage functions directly to make more advanced image manipulations than Kirby uses.

Crop position top

As of today you can't specify a crop position with the Kirby thumb function #99, but it's possible to build your own.

$simpleimageObject = new abeautifulsite\SimpleImage($image_path);
$simpleimageObject->thumbnail(150, 300, 'top')->save($thumb_path);

If you don't want to build it yourself there is a plugin for it called Kirby Crop Top.

There are many more things you can to. Read more on SimpleImage docs.

Image content url

If you are in the Panel and click on an image you will see a url like this:

https://example.com/content/1-projects/1-project-a/folding-rule.jpg

If you change the sort order of the pages you can't access the image by this url anymore.

However there is a secret redirected url that you can use. Remove content and the sorting number prefix on all the pages in the hierarchy, in the url.

https://example.com/projects/project-a/folding-rule.jpg

This url will not work as 200 but as a 302, temporary redirect.

Note

I'm personally not too fond of "magic" redirects that I did not ask for, but in this case I understand why it can be useful.

Sources