No description
  • PHP 54.2%
  • JavaScript 32.9%
  • SCSS 10.7%
  • CSS 1.2%
  • Scheme 1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-27 13:36:57 +01:00
_config Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
client Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
screenshots Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
src Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
templates Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
.babelrc Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
.editorconfig Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
.gitignore Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
_config.php Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
composer.json Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
package.json Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
README.md Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
webpack.mix.js Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00
yarn.lock Restore 2.0.0 from local copy 2026-10-27 13:36:57 +01:00

#This is a fork from https://github.com/restruct/silverstripe-focuspointcropper to Support SS6

FocusPointCropper: (Even) Smarter Image Cropping for SilverStripe

This module bolts an interface to crop an image from within the CMS, on top of Jonom's excellent FocusPoint module. This facilitates setting an initial crop of an image, which will be used as the basis for FocusPoint's smarter cropping.

Set crop & zoom level (drag/scroll) and FocusPoint (click)

Install / Composer

composer require "micschk/silverstripe-focuspointcropper" "dev-master"

Basic usage

When you edit an image in the CMS there should be an extra 'Focus Point + Crop' field. Scroll on the image to zoom, drag the image and (depending on configuration) resize the selection to set the crop area. Click on the subject of the image to set the focus area and save the image.

Config (@TODO: check/update this for SS4/5+)

Config options can be set using the SilverStripe Config API and will be fed directly to the js cropperfield. Options can be set globally or per field instance.

Settable options: https://github.com/fengyuanchen/cropper/blob/v2.3.0/README.md#options

Config example

Currently not working due to the framework not using getCMSFields() anymore... @TODO: find a hook from AssetFormFactory into the record/relation to allow that to update the config (AssetFormFactory::getFormFields(RequestHandler $controller = null, $formName, $context = []))

Restrain the aspect-ratio to be square and set the initial crop to 80% of the image for a specific page in the CMS;

public function getCMSFields(){
	...
	// Set custom config on FocusCropField for this instance
	Config::inst()->update('FocusPointCropField', 'cropconfig', array(
        'aspectRatio' => 1,
        'autoCropArea' => 0.8,
    ));
    ...
}

(the image will need to be saved and published first, for the crop to actually be applied)

Further Usage

Check the original Silverstripe FocusPoint Module