Download the PHP package micschk/silverstripe-focuspointcropper without Composer

On this page you can find all versions of the php package micschk/silverstripe-focuspointcropper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-focuspointcropper

FocusPointCropper: Smarter Image Cropping for Silverstripe

Maintained by Restruct. If this module saves you time, you can support ongoing maintenance.

This module adds a visual crop interface to Silverstripe's AssetAdmin, building on top of jonom/focuspoint. It allows editors to define an initial crop region that serves as the basis for FocusPoint's intelligent cropping.

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

Image by Nikolay Nachev (Pixabay)

Version Compatibility

Branch Module Version Silverstripe FocusPoint PHP
main 3.x ^5 \|\| ^6 ^5 \|\| ^6 ^8.1 (SS5) / ^8.3 (SS6)
(tags only) 2.0.x ^4 \|\| ^5 ^3, later ^4 \|\| ^5 ^7.4 \|\| ^8.0
(tags only) 1.x ^3 ~2.1

composer.json is the source of truth for exact version constraints. This module replaces the older micschk/silverstripe-focuspointcropper package.

Silverstripe 4 reached end of life in April 2025 and is no longer supported or tested here. Projects still on it should stay on the 2.0.x tags, which remain available. Upgrading from 2.x? See CHANGELOG.md.

Requirements and installation

Then flush and build the database (sake dev/build flush=1 on Silverstripe 5, sake db:build --flush on 6): the module adds a CropData column to Image.

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

CropData Storage

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

Image Manipulation Methods

The module adds several manipulation methods to Image:

Every method first applies the stored CropData region, then the manipulation it is named after. Without CropData (or with CropData covering the whole image) they behave exactly like the plain method. The result is a normal image variant, generated once and cached.

Cropped Methods - Apply CropData before standard manipulation:

Focus-Aware Cropped Methods - Combine CropData with FocusPoint. The focus point is moved into the cropped frame first, so it keeps pointing at the same subject:

Aliases kept from 1.x: CroppedFocusedImage($width, $height) (= CroppedFocusFill) and CroppedImageOnly($width, $height) (= CroppedFill).

CroppedOffsetFocusFill($width, $height, $offsetHorizontal = 0, $offsetVertical = 0) is work in progress: horizontal offset only (a vertical offset raises an error).

SVG Support

When used together with 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

Development Tools

Crop Functionality Test Page

A visual comparison tool is available at /dev/crop-compare to test crop functionality with both SVG and PNG images. It is open to anyone in dev mode; otherwise only to administrators (ADMIN or ALL_DEV_ADMIN). The SVG sample needs restruct/silverstripe-svg-images; without it, installing the test images installs the PNG only and the page shows the PNG column alone.

The tool:

Test Image Features:

Republishing crop data: PublishCropDataTask

Crop data is saved on the draft image. For published images whose live version has no CropData while the draft does, this task republishes them, 100 per run (run it again for the next batch):

Images whose live version already has (other) CropData are left alone.

Configuration

cropconfig is fed to the JS cropper as-is. It is configured on Image (the extension's config is merged into the class it is applied to):

Defaults: autoCropArea: 1, movable: false, rotatable: false, scalable: false, zoomable: false. For all available cropper options, see Cropper.js 1.5 documentation (the bundled version).

The CMS preview the cropper works on is FocusPointField's, which this module sets to at most 400x300:

Related Modules

Running the tests

The suite needs a booted Silverstripe project. Install the module into one through a path repository with "symlink": true (the tests/ folder is excluded from dist installs), map Restruct\ImageCropper\Tests\ to vendor/restruct/silverstripe-focuspointcropper/tests/ in its autoload-dev, then:

.github/workflows/ci.yml builds such a project per Silverstripe major.

License

BSD-3-Clause, see LICENSE, as every earlier release declared.


All versions of silverstripe-focuspointcropper with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
silverstripe/framework Version ^5 || ^6
jonom/focuspoint Version ^5 || ^6
restruct/silverstripe-simpler Version ~0.2 || ^1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package micschk/silverstripe-focuspointcropper contains the following files

Loading the files please wait ...