Rotate image (Event action)
Event action – Abstract
Purpose: Creates a target image rotated by multiples of 90° clockwise or counter-clockwise from an original image in the same file format.
►NOTE◄ This event action is only available, if the functional extension module "Document Management" is installed and licensed.
See also: Rotate image (in forms)
The Rotate image (Event action) creates a target image in the same file format, rotated clockwise or counter-clockwise by multiples of 90°, starting from an original image.
The file formats JPEG, PNG, BMP and GIF are supported.
►NOTE◄ Depending on the graphic format, compressed image data may be unpacked for rotation and then compressed again. Since the compression for the target data does not have to match the compression of the original data, the amount of data in the image may change. Even with a rotation of 0° or 360°, this can cause the image information to deviate from the original.
Configuration
The Angle parameter requires negative or positive integers, rounded to multiples of 90, to indicate the angle of rotation to be applied:
The Input image parameter must provide the original image via a value resolver whose return value corresponds to the 'action event content' or 'byte array' type. The Result image parameter defines where the target image should be saved to. The value resolver must define a suitable 'recipient' here (e.g. a variable or an object field) for a 'byte array' or the 'action event content' type. |
|
►NOTE◄ Often the original image is available as an uploaded file and the target image should also be saved as a new file or overwrite the original file. Then a File reference value resolver can be used for the Input image and Result image value resolvers respectively, which enables read and write operations in the server-side file system.
CAUTION
If a File reference value resolver is used for the Result image parameter, this requires a write access in the file system by which existing files can be overwritten or deleted without query.
This is particularly critical, since corresponding write accesses to the file system are executed without restriction even in test mode.
CAUTION
If the return value of the parameter Input image content is provided in an unsuitable file format, 'No value' (null) is output as the target image.
In conjunction with a file reference value resolver for the Result image parameter, the referenced file is then deleted!
In contrast to this, an assignment of null, e.g. to the documentContent field of a document (see Documents), simply has no effect.
Example
With the Change profile picture function, benutzer can define a personal 'profile picture', the so-called 'avatar', for the context of Lobster Data Platform / Orchestration, which can be edited a little with regard to zoom level and rotation directly after uploading.
Subsequent changes for an already uploaded profile picture, on the other hand, are not provided for by default. To demonstrate the Rotate image (Event action) event action, a function is set up to rotate the already uploaded profile image for an existing user account. For this purpose, two buttons are provided in the Users overview of the ribbon, which rotate the respective profile picture by 90° to the left or right in combination with a single selection for a user account.
Runtime example:
These two buttons are intended to allow the 'Avatar' to be rotated to the left or right when a specific user is selected.
Configuration:
For each of the two menu commands an Custom action event is set up, which is to be triggered by the respective button (see Ribbon macros or Available commands/'Custom action event').
A common event handling for the two Triggering events 'Rotate Left' (ROTATE_LEFT) and 'Rotate Right' (ROTATE_RIGHT) is created and configured as shown on the right:
The Actions on passed rule is passed are first presented here in an overview. Details per action follow below:
►NOTE◄ By default, the profile picture does not appear to be visible in the details for the selected user account. The rotated image will not appear until the next time the user in question logs in. Even if the profile picture of the logged-in user is rotated, it does not appear immediately in the top left corner of the user area of the menu bar in the existing session. ►NOTE◄ The rotation overwrites the file referenced in the user account. Nothing changes in the reference in the user account. In this respect, the change takes effect without saving the user account. |
|
Configuration details:
The first Set value event action assigns the file path to the profile picture of the user present as input object to the avatarFilePath variable:
Runtime example: avatarURL="img://avatar/user_avatar_101.png?c=1619013361517" avatarFilePath="./upload/web/avatar/user_avatar_101.png" |
|
The following case distinction per If then else event action shall define the rotation angle for either left or right rotation depending on the ribbon button pressed at runtime.
|
|