Brightspot CMS Developer Guide

Image editor configuration


Dari provides two image editor classes for image resizing, both of which use a web service API over HTTP.

The production implementation, DimsImageEditor, is built on Apache DIMS (Dynamic Image Manipulation Service). The testing implementation, JavaImageEditor, uses the ImageIO library. In Brightspot, the implementation that is configured for use is exposed in the image editor (see the illustration "Image editing form").

As implementations of SettingsBackedObject, DimsImageEditor and JavaImageEditor can be initialized by values stored in a configuration file. The following example shows configuration of the DIMS image editor in a Tomcat context.xml file:

<!-- DIMS -->
 <Environment name="dari/defaultImageEditor" type="java.lang.String" value="dims" /> 
 <Environment name="dari/imageEditor/dims/class" type="java.lang.String" value="com.psddev.dari.util.DimsImageEditor" /> 
 <Environment name="dari/imageEditor/dims/sharedSecret" type="java.lang.String" value="XCCC48" /> 
 <Environment name="dari/imageEditor/dims/useLegacyThumbnail" type="java.lang.String" value="false" />
  • Sets the default image editor to the one identified as dims.
  • Specifies the class for the DIMS image editor.
  • Sets the configuration key sharedSecret to XCCC48.
  • Sets the configuration key useLegacyThumbnail to false.

The following sections describe the options for image editor configuration.


The following table lists available context.xml default configuration values for an image editor.

General configuration settings for image editor

KeyTypeDescription
dari/defaultImageEditorjava.lang.StringName of the default image editor.
  • For DimsImageEditor, set to dims.
  • For JavaImageEditor, set to _java.

For subsequent configuration options, replace {implementation} with dims or _java. Clients can override this default value by specifying an image editor in the URL; for details, see Understanding image URLs. (For information about default configurations, see Configuration identifiers, key prefixes, and defaults.)

dari/imageEditor/{implementation}/classjava.lang.StringFully qualified class name of a com.psddev.dari.util.ImageEditor implementation.
dari/imageEditor/{implementation}/cropjava.lang.StringCropping option. Available settings are noneautomaticcirclestar, and starburst. The default is automatic.
dari/imageEditor/{implementation}/resizejava.lang.StringResize option. Available settings are ignoreAspectRatioonlyShrinkLargeronlyEnlargeSmaller, and fillArea. The default is to do nothing.
dari/imageEditor/{implementation}/baseUrljava.lang.StringBase URL to the image editor implementation.
  • For JavaImageEditor, if no baseUrl is set, Dari uses the baseUrl from the request.
  • For DimsImageEditor, if no baseUrl is set, Dari falls back to first item from the setting dari/imageEditor/dims/baseUrls (see table Configuring a DIMS image editor).
dari/imageEditor/{implementation}/privateBaseUrljava.lang.StringPrivate base URL for the image editor implementation. If this URL is set, it will be used as the base URL.

The following table lists available context.xml default configuration values for a DIMS image editor.

Configuration settings for DIMS image editor

KeyTypeDescription
dari/imageEditor/dims/baseUrlsjava.lang.StringOptional subsetting of dari/imageEditor/dims/baseUrls that is used to construct the base URL of the DIMS URL (see table "General configuration settings for image editor"). If the image URL is already a DIMS URL, then the DIMS base URL matching the base URL of that image URL is used; otherwise, the image URL is hashed and the DIMS-based URL is picked from the list of base URLs that are set on this option.
dari/imageEditor/dims/sharedSecretjava.lang.StringShared secret to use when signing URLs. The default is to not use a shared secret.
dari/imageEditor/dims/expireTimestampjava.util.DateExpiration date of a signed URL. Set either this key or expireDuration, but not both. If neither key is set, then there is no expiration time.
dari/imageEditor/dims/expireDurationjava.lang.LongExpiration duration in seconds of a signed URL. Set either this key or expireTimestamp, but not both.
dari/imageEditor/dims/qualityjava.lang.IntegerQuality in percentage for the output image (do not include percent sign). By default, quality is 100%.
dari/imageEditor/dims/useLegacyCropbooleanEnables the use of DIMS’s legacy crop command.
  • If false (the default), all crops are done automatically, regardless of the crop dimensions provided (x, y, width, height). Resize and crop are done in a single operation.
  • If true, backward compatibility behavior is enforced. If there are crop dimensions (x, y, width, height) defined, then a normal (non-auto) crop takes place. If however, only the width and height are present, then an automatic crop occurs.
dari/imageEditor/dims/useLegacyThumbnailbooleanEnables the use of DIMS’s legacy thumbnail command. The command behavior is synonymous with the DIMS crop command. The default is false.
dari/imageEditor/dims/preserveMetadatabooleanEnables preservation of the image’s metadata. The default is true.
dari/imageEditor/dims/appendImageUrlsbooleanEnables appending image URLs instead of passing them as a parameter.

If dari/imageEditor/dims/appendImageUrls is false (the default), Dari constructs the DIMS URL to pass the image URL as a parameter (includes ?url parameter), for example:

http://domain.com/dims4/default/4d5c026/2147483647/strip/true/crop/90x58+156+104/resize/85x55?url=http%3A%2F%2Fdomain%2Fid%2F%2Fbowtie.png

If dari/imageEditor/dims/appendImageUrls is true, Dari constructs the DIMS URL to append the image URL (excludes ?url parameter), for example:

http://domain.com/dims4/default/4d5c026/2147483647/strip/true/crop/90x58+156+104/resize/85x55/http%3A%2F%2Fdomain%2Fid%2F%2Fbowtie.png

You can control some of the parameters passed to DIMS at runtime. For details, see Image format.

See also:

Previous Topic
Storage item configuration
Next Topic
Configuring Brightspot for SAML
Was this topic helpful?
Thanks for your feedback.
Our robust, flexible Design System provides hundreds of pre-built components you can use to build the presentation layer of your dreams.

Asset types
Module types
Page types
Brightspot is packaged with content types that get you up and running in a matter of days, including assets, modules and landing pages.

Content types
Modules
Landing pages
Everything you need to know when creating, managing, and administering content within Brightspot CMS.

Dashboards
Publishing
Workflows
Admin configurations
A guide for installing, supporting, extending, modifying and administering code on the Brightspot platform.

Field types
Content modeling
Rich-text elements
Images
A guide to configuring Brightspot's library of integrations, including pre-built options and developer-configured extensions.

Google Analytics
Shopify
Apple News