Data Types

UploadWidgetEditor

Image editor options for the Upload Widget.

{
"crop": Boolean,
"cropFilePath": Function,
"cropRatio": Number,
"cropShape": String,
"preview": Boolean
}
}
{
"images": {
"allowResizeOnMove": true,
"crop": true,
"cropFilePath": Function,
"cropRatio": 1,
"cropShape": "circ",
"preview": true
}
}

If false then prevents the image cropper from resizing when moved.

Default: true

Type: Boolean

Enables/disables the image cropper.

Default: true

Type: Boolean

A callback allowing you to override the name of the image.<ext>.crop JSON file, which is generated for cropped images.

This callback takes an object of type UploadedFile (this is the original image).

This callback must return a FilePathDefinition indicating the filePath to use for the cropped image (i.e. the JSON file).

Important: you must not return the same file path as the original image (the returned file path must not already exist).

How image cropping works: when images are cropped using the Bytescale Upload Widget, two files are uploaded: the original image, and a JSON file containing the crop geometry with a link to the original image. When this JSON file is requested via the Image Processing API (i.e. when you replace /raw/ with /image/) you will receive a cropped image instead of a JSON response.

Default: x => x.filePath + ".crop"

Type: Function

Crop aspect ratio as W/H.

For example, for a 16:9 widescreen aspect ratio use 1.778 (i.e. 16/9).

If unspecified and rect is used for cropShape, then does not enforce an aspect ratio (i.e. allows freeform cropping).

If unspecified and circ is used for cropShape, then uses a 1:1 aspect ratio. Only 1:1 is supported for circ.

Example: 1

Type: Number

The crop shape to use.

If "circ" is specified, then the resulting image will still be rectangular. You are expected to crop the image when displaying it via a border-radius: 50% CSS property. This provides sharper image edges, and also provides the greatest level of flexibility, e.g. if you decide to display square images in future.

Default: "rect"

Type: String

Allowed Values: "circ", "rect"

Enables/disables previews of PDFs, videos, and images, which are displayed to the user immediately after they upload the file.

Defaults to the effective value of the crop parameter.

Type: Boolean

Was this section helpful? Yes No

You are using an outdated browser.

This website requires a modern web browser -- the latest versions of these browsers are supported: