Docs
API Docs

Force Crop

You can force the user to crop the input image to one of a set of predefined ratios before he can do any additional editing to it. This is can be done by passing the option forceCrop to the editor, and setting the availableRatios of the transform tool to the desired allowed ratios:

var editor = new PhotoEditorSDK.UI.DesktopUI({
  editor: {
    forceCrop: true,
    controlsOptions: {
      transform: {
         availableRatios: ['imgly_transform_common_4-3', 'imgly_transform_common_16-9']
      }
    }
  }
})
var editor = new PhotoEditorSDK.UI.ReactUI({
  editor: {
    forceCrop: true,
    controlsOptions: {
      transform: {
         availableRatios: ['imgly_transform_common_4-3', 'imgly_transform_common_16-9']
      }
    }
  }
})

All other tools, except the library, when enabled, are disabled until the user accepts a crop transform with one of the given values.