PHPackages                             restruct/silverstripe-focuspointcropper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. restruct/silverstripe-focuspointcropper

ActiveSilverstripe-vendormodule[Image &amp; Media](/categories/media)

restruct/silverstripe-focuspointcropper
=======================================

Even smarter automatic image cropping for SilverStripe

2.0.8(3mo ago)1648↓100%1[1 issues](https://github.com/restruct/silverstripe-focuspointcropper/issues)BSD-3-ClausePHP

Since May 23Pushed 3mo agoCompare

[ Source](https://github.com/restruct/silverstripe-focuspointcropper)[ Packagist](https://packagist.org/packages/restruct/silverstripe-focuspointcropper)[ RSS](/packages/restruct-silverstripe-focuspointcropper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (20)Used By (0)

FocusPointCropper: Smarter Image Cropping for Silverstripe
==========================================================

[](#focuspointcropper-smarter-image-cropping-for-silverstripe)

This module adds a visual crop interface to Silverstripe's AssetAdmin, building on top of [jonom/focuspoint](https://github.com/jonom/silverstripe-focuspoint). It allows editors to define an initial crop region that serves as the basis for FocusPoint's intelligent cropping.

[![Crop interface in AssetAdmin](docs/cropper.png)](docs/cropper.png)

*Set crop &amp; zoom level (drag/scroll) and FocusPoint (click) directly in the CMS.*

Image by [Nikolay Nachev](https://pixabay.com/users/na4ev-1481419/?utm_source=link-attribution&utm_medium=referral&utm_campaign=image&utm_content=988046) (Pixabay)

Version Compatibility
---------------------

[](#version-compatibility)

BranchModule VersionSilverstripeFocusPointPHP`master``2.x`^4.0 || ^5.0^4.0 || ^5.0^7.4 || ^8.0**Note:** `composer.json` is the source of truth for exact version constraints. This module replaces the older `micschk/silverstripe-focuspointcropper` package. Silverstripe 6 support is planned.

Basic Usage
-----------

[](#basic-usage)

When you edit an image in the CMS (AssetAdmin), an extra "Focus Point + Crop" field appears:

1. **Scroll** on the image to zoom in/out
2. **Drag** the image to pan and position the crop area
3. **Click** on the subject of the image to set the focus point
4. **Save** the image to apply the crop data

The crop data is stored on the image and used as the basis for all subsequent manipulations.

How It Works
------------

[](#how-it-works)

### CropData Storage

[](#cropdata-storage)

When you define a crop region in the CMS, the module stores `CropData` as JSON on the Image record. This contains:

- Crop region coordinates (x, y, width, height)
- Zoom level
- Canvas dimensions

### Image Manipulation Methods

[](#image-manipulation-methods)

The module adds several manipulation methods to `Image`:

**Cropped Methods** - Apply CropData before standard manipulation:

- `CroppedImage($width, $height)` - Apply crop, then resize to fit
- `CroppedFill($width, $height)` - Apply crop, then fill exact dimensions
- `CroppedFocusFill($width, $height)` - Apply crop, then focus-aware fill

**Focus-Aware Cropped Methods** - Combine CropData with FocusPoint:

- `CroppedFocusFill($width, $height)` - Uses both CropData and FocusPoint for optimal results
- `CroppedFocusCropWidth($width)` - Crop to width, respecting both crop region and focus point
- `CroppedFocusCropHeight($height)` - Crop to height, respecting both crop region and focus point

### SVG Support

[](#svg-support)

When used together with [restruct/silverstripe-svg-images](https://github.com/restruct/silverstripe-svg-images), all crop methods work seamlessly with SVG files. The svg-images module automatically detects when this module is installed and enables crop support for SVGs.

Template Usage
--------------

[](#template-usage)

```

```

Development Tools
-----------------

[](#development-tools)

### Crop Functionality Test Page

[](#crop-functionality-test-page)

A visual comparison tool is available at `/dev/crop-compare` to test crop functionality with both SVG and PNG images.

[![Crop Compare Test Tool](docs/crop-compare-test.png)](docs/crop-compare-test.png)

The tool:

- Tests all Cropped\* methods (CroppedImage, CroppedFill, CroppedFocusFill, etc.)
- Compares regular manipulations with Cropped\* versions
- Shows badges indicating which methods use CropData and/or FocusPoint
- Includes bundled test images with pre-configured CropData and FocusPoint
- Works with custom image IDs for testing your own images

**Test Image Features:**

- **Dashed lines** mark the crop boundaries
- **White crosshair** marks the FocusPoint location
- **Orange triangle** is near the FocusPoint - should stay visible in FocusFill crops
- **Red circle** is left of center - may be cropped in narrow FocusFill

Configuration
-------------

[](#configuration)

Configuration options can be set using Silverstripe's Config API:

```
# Cropper field configuration
Restruct\SilverStripe\ImageCropper\FocusPointCropField:
  cropconfig:
    aspectRatio: 1.777  # 16:9 ratio
    autoCropArea: 0.8   # Initial crop covers 80% of image
```

For all available cropper options, see [Cropper.js documentation](https://github.com/fengyuanchen/cropper/blob/v2.3.0/README.md#options).

Related Modules
---------------

[](#related-modules)

- [jonom/focuspoint](https://github.com/jonom/silverstripe-focuspoint) - Required. Provides the FocusPoint field and basic focus-aware cropping
- [restruct/silverstripe-svg-images](https://github.com/restruct/silverstripe-svg-images) - Optional. Enables full SVG support including crop methods
- [restruct/silverstripe-simpler](https://github.com/restruct/silverstripe-simpler) - Required. Provides form field utilities

License
-------

[](#license)

BSD-3-Clause

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance60

Regular maintenance activity

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 80.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~196 days

Recently: every ~88 days

Total

19

Last Release

104d ago

Major Versions

1.6 → 2.02021-06-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d3680d6353e5f171543435b89965ba2588186ad7ec0ec97cbf572704fec2a4f?d=identicon)[micschk](/maintainers/micschk)

---

Top Contributors

[![micschk](https://avatars.githubusercontent.com/u/1005986?v=4)](https://github.com/micschk "micschk (25 commits)")[![hubertusanton](https://avatars.githubusercontent.com/u/582188?v=4)](https://github.com/hubertusanton "hubertusanton (2 commits)")[![straathof](https://avatars.githubusercontent.com/u/9931668?v=4)](https://github.com/straathof "straathof (2 commits)")[![purplespider](https://avatars.githubusercontent.com/u/329880?v=4)](https://github.com/purplespider "purplespider (1 commits)")[![spekulatius](https://avatars.githubusercontent.com/u/8433587?v=4)](https://github.com/spekulatius "spekulatius (1 commits)")

---

Tags

imagesilverstripefocuscropcroppingfocuspoint

### Embed Badge

![Health badge](/badges/restruct-silverstripe-focuspointcropper/health.svg)

```
[![Health](https://phpackages.com/badges/restruct-silverstripe-focuspointcropper/health.svg)](https://phpackages.com/packages/restruct-silverstripe-focuspointcropper)
```

###  Alternatives

[jonom/focuspoint

Smarter automatic image cropping for Silverstripe

108645.6k49](/packages/jonom-focuspoint)[stefangabos/zebra_image

A single-file, lightweight PHP library designed for efficient image manipulation featuring methods for modifying images and applying filters

141110.4k6](/packages/stefangabos-zebra-image)[reliqarts/laravel-guided-image

Simplified and ready image manipulation for Laravel via intervention image.

351.4k](/packages/reliqarts-laravel-guided-image)[chrometoaster/silverstripe-image-quality

Adds Quality function to images

1013.0k1](/packages/chrometoaster-silverstripe-image-quality)[ayvazyan10/nova-imagic

Imagic is a Laravel Nova field package that allows for image manipulation capabilities, such as cropping, resizing, quality adjustment, and WebP conversion. It utilizes the powerful Intervention Image class for image manipulation.

144.3k1](/packages/ayvazyan10-nova-imagic)[spescina/imgproxy

An image proxy for Laravel

201.3k](/packages/spescina-imgproxy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
