Download the PHP package willmorgan/silverstripe-cropperfield without Composer

On this page you can find all versions of the php package willmorgan/silverstripe-cropperfield. 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-cropperfield

SilverStripe CropperField

Build Status

Do you need to crop your images for art direction purposes?

Perhaps this is for responsive design, or perhaps you're tired of CroppedResize, PaddedResize, Square and general centre-based resizing functionality in SilverStripe that doesn't quite meet your image cropping needs.

Maybe CropperField is for you. Whilst it's called CropperField, that's just the user interface. Behind the scenes, a clean and extensible architecture allows you to crop almost anything - external URLs, documents, video frames, etc..

For the field itself, the frontend is powered by Cropper v0.7.5 by Fengyuan Chen.

Warning: Under development / alpha. Do not use unless you are prepared to contribute!

Installation

  1. composer require willmorgan/silverstripe-cropperfield
  2. Specify a version constraint.
    • While this module is in heavy development, you probably want to use ~0.X or similar.

Screenshot

The field currently looks like this in a CMS setting.

Usage

  1. Specify a $has_one Image relationship on the object that should own the cropped image.
  2. Specify an image based UploadField whose image you wish to crop.
    • Only UploadField is supported right now. Non-images will break. Sorry.
  3. Create an AdapterInterface implementor to pass into your CropperField
    • See [1]; the adapters are generic enough for you to supply anything - as long as there's a File object backing it (regardless of whether it exists).
  4. Set some options, if you so desire.
  5. Happy cropping.

Example

In this example, a configuration like this has been set up:

Inside a getCMSFields call, or similar:

You can now use $MyArtDirectionCrop in your template as you would any other image (i.e. you can use $ResizeRatio, $Square, etc.)

The initial benefit is the CMS user gets to specify the true focus point of a potentially high resolution image, and you / your frontend team can reuse that base cropped image responsively, be it using srcset, picture + source, etc.

Options

You can set these options on the CropperField to get some control over your CMS users' actions.

Option name Value example Default value Description
aspect_ratio null or positive float, like 16/9 null The aspect ratio you want generated cropped images to have.
crop_min_width Positive integer, like 256 256 The minimum dimensions a crop can be, in px.
crop_min_height Positive integer, like 256 256
crop_max_width null or positive integer null Maximum dimensions a crop can be, in px.
Blank by default because this restricts the art direction somewhat. If you wish to limit the actual generated size of the cropped image, set generated_max_* instead.
crop_max_height null or positive integer null
generated_max_width Positive integer, like 512 512 The maximum dimensions a generated image can be, in px.
If the crop is above this, then it will be downscaled according to the declared aspect ratio, or the implied aspect ratio if one is not specified.
generated_max_height Positive integer, like 512 512

Supplied Adapters

Supplied Croppers

Customisation

Compatibility

Similar modules

If this doesn't look right for you*, check out some alternatives:

* As a sidenote, I'd appreciate you taking the time to let me know why

Licensing

Built by

Will Morgan, who is available for hire.


All versions of silverstripe-cropperfield with dependencies

PHP Build Version
Package Version
Requires silverstripe/framework Version ^3.1
composer/installers Version ~1.0
php Version >=5.3
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 willmorgan/silverstripe-cropperfield contains the following files

Loading the files please wait ....