Image modeling
Brightspot includes a wide variety of image editing capabilities, including cropping, brightness, sharpness and color adjustment, image rotation, blurring, and text overlays.
Brightspot includes a wide variety of image editing capabilities, including cropping, brightness, sharpness and color adjustment, image rotation, blurring, and text overlays.
To begin using and editing images in Brightspot, define a storage mechanism.
You configure storage locations for images (and any other binary file) in the Tomcat context.xml
file. For information about the various configuration scenarios, see Configuring StorageItem.
Brightspot offers two image editors, Java Image Editor for testing and DIMS Image Editor for production. Configure an image editor in the Tomcat context.xml
file. See Image editor configuration for more information.
An Image object with StorageItem
and renderer
must be created to begin using images. See Image object model for more information.
To begin using and editing images in Brightspot, the Image object needs to be created by creating an Image.java
class with a StorageItem
as the file to be uploaded to the default storage mechanism:
public class Image extends Content {
private String name;
private StorageItem file;
private String altText;
// Getters and Setters
}
Once the Image object is in place, you can begin to work with image content in Brightspot. Several functionalities can be added to image content by adding annotations.
Preview
To allow an image to be previewed in Brightspot but not, as by default, in the text field, add the following annotation to the Image
class.
@PreviewField("file")
public class Image extends Content {
private String name;
private StorageItem file;
private String altText;
//Getters and Setters
}
The system will use the StorageItem
field as a preview.
Adding to rich text
You can reference images in the rich-text editor and add them as enhancements to your content. To enable an image for reference, add the following annotation:
@ToolUi.Referenceable
public class Image extends Content {
private String name;
private StorageItem file;
private String altText;
//Getters and Setters
}
Bulk upload
Brightspot’s bulk upload feature, located on the dashboard, allows you to upload multiple files simultaneously. To upload images and automatically populate any required fields, add the following as a beforeSave
to automatically use the original file name as the image name.
@Override
public void beforeSave() {
if (StringUtils.isBlank(name)) {
if (file != null) {
Map<string, object=""> metadata = file.getMetadata();
if (!ObjectUtils.isBlank(metadata)) {
String fileName = (String) metadata.get("originalFilename");
if (!StringUtils.isEmpty(fileName)) {
name = fileName;
}
}
}
}
}