Class LoadImageDirective
java.lang.Object
ch.tocco.nice2.dms.impl.freemarker.LoadImageDirective
- All Implemented Interfaces:
Nice2TemplateDirective, TemplateIdentifiers, freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel
public class LoadImageDirective
extends Object
implements Nice2TemplateDirective, TemplateIdentifiers
Loads an image of an entity as base64 data URI (usable as
src of an img tag).
An empty string is returned if there is no image or the user is not allowed to read it.
Parameters:
path(required): The path from the entity to the image. The path ends in a document (binary) field and may follow relations (e.g.relSerial_correspondence.signature_image1). Only to-one relations can be followed, to-many relations need a selector. The user needs the content read permission of the document, e.g. offline documents are only visible with write permission.entity(optional): The entity the path starts at. If not set, the base data of the template is used.name(optional): The name of the variable to load the image to. If no name is passed, the image is printed.
-
Nested Class Summary
Nested classes/interfaces inherited from interface TemplateIdentifiers
TemplateIdentifiers.Scope -
Field Summary
Fields inherited from interface TemplateIdentifiers
BASEDATA_VAR, DELIMITER_PARAM, ENTITY_PARAM, INLINE_TEMPLATE, KEY, LIMIT_PARAM, LINE_END_PARAM, LINE_START_PARAM, NAME_PARAM, PATH_PARAM, PATHS_PARAM, PATTERN_PARAM, RECIPIENT_VAR, SCOPE_PARAM, SENDER_VAR, SINGLE_BASE_VAR, TARGET_VAR, VALUE_PARAMFields inherited from interface freemarker.template.TemplateModel
NOTHING -
Constructor Summary
ConstructorsConstructorDescriptionLoadImageDirective(org.slf4j.Logger log, EntityDocumentsService entityDocumentsService) -
Method Summary
-
Constructor Details
-
LoadImageDirective
-
-
Method Details
-
execute
public void execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body) throws freemarker.template.TemplateException, IOException - Specified by:
executein interfacefreemarker.template.TemplateDirectiveModel- Throws:
freemarker.template.TemplateExceptionIOException
-