At the moment, if you are using the widget, there is no way to change settings at runtime. Yet, you can set a number of aspect ratios for a user to choose in the dialog:
See the Pen Preset crop values by uploadcare (@uploadcare) on CodePen.
Alternatively, you can use the dialog API instead of the widget. For example, you can create a custom button, and open the widget dialog with custom crop settings by clicking on it
myButton.addEventListener('click', () => {
const dialog = uploadcare.openDialog(null, '', {
crop: '3:4'
})
})
Actually, you can do the same with the widget as well with the widget.openDialog()
method that takes a settings object as an argument, but you will need to set an external trigger opening the widget with updated settings.
const widget = uploadcare.Widget('[role=uploadcare-uploader]')
widget.openDialog({
crop: '3:4'
})