2017 © Pedro Peláez
 

silverstripe-module salted-cropper

Salted Herring's Image Cropper Field

image

salted-herring/salted-cropper

Salted Herring's Image Cropper Field

  • Tuesday, June 26, 2018
  • by saltedherring
  • Repository
  • 2 Watchers
  • 1 Stars
  • 1,037 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 15 Versions
  • 12 % Grown

The README.md

Salted Cropper

Salted Herring's Cropper Field for SilverStripe. This is to avoid the deadly issue that FileSync task will disconnect all cropped images, when using silverstripe-cropperfield. Please remove silverstripe-cropperfield module if you have already installed it, other it will result in funny conflict., (*1)

2.0.0

Because in 1.x versions, cropping happens directly on the images, which makes them not available for "reuse", 2.0.0 is now to resolve this issue by redesigning the way that the cropper tool works., (*2)

Pleaes note: SaltedUploader will be retired soon. Please replace all SaltedUploader occurrences with CroppableImageField!!, (*3)

Usage

  1. Download it to SilverStripe's root directory, (*4)

    git clone git@github.com:salted-herring/salted-cropper.git
    

    or, (*5)

    composer require salted-herring/salted-cropper
    
  2. Sake it, (*6)

    sake dev/build
    
  3. flush frontend and backend's cache, (*7)

  4. Sample code:, (*8)

    protected static $has_one = array(
        'Photo'     =>  'SaltedCroppableImage'
    );
    
    
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        ...
        // adding a free cropper
        $fields->addFieldToTab(TAB_NAME, CroppableImageField::create('PhotoID', A_TITLE_TO_THE_FILED);
    
        // adding cropper with ratio
        $fields->addFieldToTab(TAB_NAME, CroppableImageField::create('PhotoID', A_TITLE_TO_THE_FILED)->setCropperRatio(16/9));
        ...
        return $fields;        
    }
    
    
  5. Add image > upload/select > save > edit > do your cropping, (*9)

  6. Output, (*10)

    $Photo
    $Photo.Cropped
    $Photo.Cropped.SetWidth(100)
    

1.x

This doc is for 1.0 and above. If you are using 1.0- versions, do not use this doc., (*11)

Usage (internal usage for now)

  1. Download it to SilverStripe's root directory, (*12)

    git clone git@github.com:salted-herring/salted-cropper.git
    

    or, (*13)

    composer require salted-herring/salted-cropper
    
  2. Sake it, (*14)

    sake dev/build
    
  3. flush frontend and backend's cache, (*15)

  4. Sample code:, (*16)

    protected static $has_one = array(
        'Photo'     =>  'Image'
    );
    
    
    public function getCMSFields() {
        $fields = parent::getCMSFields();
        ...
        // adding a free cropper
        $fields->addFieldToTab(TAB_NAME, SaltedUploader::create('Photo', A_TITLE_TO_THE_FILED);
    
        // adding cropper with ratio
        $fields->addFieldToTab(TAB_NAME, SaltedUploader::create('Photo', A_TITLE_TO_THE_FILED)->setCropperRatio(16/9));
        ...
        return $fields;        
    }
    
    
  5. Upload and image, and then click the edit button - in the drop down area, you will see the cropper area. Do the cropping and then save the image (NOTE: if you don't save the image editing, before you save the page/data object, it will not take effect), (*17)

  6. Output, (*18)

    $Photo
    $Photo.Cropped
    $Photo.Cropped.SetWidth(100)
    

The Versions

26/06 2018

dev-master

9999999-dev https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

26/06 2018

dev-develop

dev-develop https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

26/06 2018

2.0.8

2.0.8.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

07/02 2018

2.0.7

2.0.7.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

07/02 2018

2.0.6

2.0.6.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

07/02 2018

2.0.5

2.0.5.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

07/02 2018

2.0.4

2.0.4.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

07/02 2018

2.0.3

2.0.3.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

07/02 2018

2.0.2

2.0.2.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

01/02 2018

2.0.1

2.0.1.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

28/01 2018

2.0.0

2.0.0.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

24/01 2018

dev-feature/manymany

dev-feature/manymany https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

17/10 2017

1.0.4

1.0.4.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

28/10 2016

1.0.2

1.0.2.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field

  Sources   Download

MIT

php library

18/10 2016

0.0.3

0.0.3.0 https://github.com/salted-herring/salted-library

Salted Herring's Image Cropper Field (in progress)

  Sources   Download

MIT

php library