Coder Social home page Coder Social logo

salted-herring-salted-cropper's Introduction

Salted Cropper (1.0)

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.

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

Usage (internal usage for now)

  1. Download it to SilverStripe's root directory
git clone [email protected]:salted-herring/salted-cropper.git

or

composer require salted-herring/salted-cropper
  1. Sake it
sake dev/build
  1. flush frontend and backend's cache

  2. Sample code:

    protected static $has_one = array(
        'Photo'     =>  'Image'
    );
    
    
    public function getCMSFields() {
        $fields = parent::getCMSFields();
        ...
        $fields->addFieldTotTab(TAB_NAME, SaltedUploader::create('Photo', A_TITLE_TO_THE_FILED)->setCropperRatio(16/9));
        ...
        return $fields;        
    }
  3. 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)

  4. Output

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

salted-herring-salted-cropper's People

Contributors

leochenftw avatar

Watchers

James Cloos avatar helpfulrobot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.