Focus // Define an image focus point


Yes, I had a similar effect when I tested this briefly with IM, but didn’t have time to look into it any further so far.


Thanks a lot for your replies @Malvese and @texnixe. I will have a look at it again. Maybe my setup was not right.


It might be just me missing the “how does this work” part ^^. So you define that focus spot with a simple click and then? Does this plugin save the resized versions of the images back to the file system or are they just created once a user makes the request? Is this plugin the right one if you want to use responsive images (e.g. creating 3 different version for mobile / tablet / desktop ?)

Maybe I need to try it out to understand the way this plugin works. But it would be great to put some more helpful text into the description so people can better decide if this plugin would solve someones problem or not.

At least for me this is not totally clear.

Never the less this looks really interesting for me, but have to see if it solves my problem of cropping images (or if it is even working on my shared hosting)


The plugin does two things:

  1. it provides a custom field that allows you to set a focus point. The focus point is saved to the meta data file.
  2. it provides a new method focusCrop(), which uses the focus point saved in the meta data file to crop an image in such a way that the focus point is in the center of the cropped image.

And yes, of course, you can use the plugin to create different sized responsive images just in the same way as you would use the inbuilt cropping method. You don’t need the plugin if you want to simply resize images without cropping.


After struggling a bit with my local ImageMagick setup I think Kirby Focus is now ready to go with ImageMagick. I pushed my changes to the develop branch. Anyone interested in testing? @Malvese @texnixe? Any feedback is appreciated :smiley:

Please notice that setting a custom tumb driver is not necessary anymore. The plugin overrides the default GD or IM driver.

So for IM testing add the following line to your config.php

c::set('thumbs.driver', 'im');

Thanks in advance!


Sure, I’ll test it as soon as possible :slight_smile:


Fantastic! I had a feeling it could be done that way, but didn’t have time to dig deeper. You know, I had to choose between coding and jumping in the swimming pool :wink:

I’ll test ASAP.


Ok I took some time to test, and it seems to work as expected :grinning: :poultry_leg: Thank you very much!

Imagick is so much better than gd, better quality, crispier images with equivalent or smaller file sizes…


:tada: Thanks a lot for testing!

I think I should polish the documentation a bit and then ship v1.0 :smiley:


Sorry, Flo, I haven’t got round to testing it yet, somehow I messed up ImageMagick …


No problem and nevertheless thanks for your support! I really appreciate your work for the community.


##Version 1.0

Finally … :tada:


##Version 1.0.1

Fixed a small positioning issue after saving the focus point in the panel.

/cc @jenstornell


looks awesome, definitly will try this out soon.


Will give it a go, thanks Flo.


i noticed, when changing the focus point after thumbnail has been created before, my thumbnail is not getting refreshed. is there any chance i need to adjust to get that sorted out?


This is strange?! The file name of the thumb should contain the x and y coordinate (as well as the quality factor) so that changing the focus point forces Kirby to generate a new thumbnail with a different name.

Could you please check if the changed focus point is saved correctly to the files’ meta data (txt file) and if the filenames of the thumbs contain the x and y coordinates?



to change my thumbs folder i have this added to my config

c::set('thumbs.destination', function($thumb) {

  $page     = $thumb->source->page();
  $filename = $thumb->source->name() . '-' . $thumb->settingsIdentifier() . '.' . $thumb->source->extension();
  $root     = $thumb->options['root'] . DS . str_replace('/', DS, $page->uri()) . DS . $filename;
  $url      = $thumb->options['url'] . '/' . $page->uri() . '/' . $filename;

  // create the directory

  return new Obj(array(
    'url'  => $url,
    'root' => $root


might this conflict with focus?
when i remove this config setting, focus won’t even load any picture, while with it, it works just fine unless i change focus point and the thumbs not getting renewed.

setting c::set(‘thumbs.driver’, ‘focusIM’); does not work for me, too.

the txt file shows the coordinates just right, the thumb filename however does not seem to have any.


I think the problem with this custom thumb setup is that $thumb->settingsIdentifier() does not consider the focus coordinates. I’m not sure if I can extend this method … I may have a look at this in the future.

c::set('thumbs.driver', 'focusIM') won’t work, because since IM is officially supported (as of v0.4) the plugin overrides the default thumbs driver. This setting exists only while testing things out on the develop branch.

If you are using IM just stick to c::set('thumbs.driver', 'im'). This should work with the latest version of the plugin.


Version 1.0.2

There’s a small update. The main new feature is the introduction of two new file methods:


In addition to this I fixed a php 5.4 issue and enhanced the README.