Cropping thumbs from top instead of Center

I would like create square thumbs out of rectangle images, but cropping from the top instead of the center. Is there a way to change the default thumb cropping gravity from Center to top in the thumb.php file?

1 Like

I took a look at the code, but it seems to be hard coded.
I know, that there was an option for this in kirby 1, but it will be useful to have it in kirby 2 too.

I would recommend to open an issue at github (toolkit repository) and change the tag of this forum thread to issue or feature request.

1 Like

Thanks, I’ll do that.

I added an issue on github because I could not find any on this subject. When cropping screenshots or people it would be nice to se "position" => "top".

But the guy on my picture, gets his legs and arm on the left cut off, if it isn’t at x: 275 y: 200 though :wink:

Too bad for him. Hope he is ok. :wink:

No arms, no cookies. :grin:

Here is a workaround:

$image = new abeautifulsite\SimpleImage( $image_or_thumb_path );
$image->crop(0, 0, 580, 280);
$image->save( $new_thumb_path );

It looks simple and it is, but it’s getting a little bit messy when extracting some input path, output path and output url. Therefor I still think it’s important that this is still a suggestion and not a solved issue.

1 Like