Orbeon Forms
Search…
Image attachment

What it does

This component represents an attachment to a form which has to contain an image. The image is displayed by the component when attached.

Accepted mediatypes

By default the component accepts image/* mediatypes.
[SINCE Orbeon Forms 2017.1]
If an upload-mediatypes custom constraint is present and not blank, it is used applied to the enclosed upload control. If missing, the default is image/*.

Events

[SINCE Orbeon Forms 2017.1]
This component dispatches the following events following the enclosed upload control:
  • xxforms-upload-start
  • xxforms-upload-cancel
  • xxforms-upload-done
  • xxforms-upload-error

Image transformation

[SINCE Orbeon Forms 2022.1]
The component can transform the uploaded image. The following attributes control the transformation:
  • transform-max-width:
    • no attribute: use the default (form-level then property)
    • blank attribute value: don't constrain the image width
    • positive integer: scale the image width to the given value if the image is larger
    • the image's aspect ratio is preserved when used in conjunction with transform-max-height
  • transform-max-height:
    • no attribute: use the default (form-level then property)
    • blank attribute value: don't constrain the image width
    • positive integer: scale the image hight to the given value if the image is larger
    • the image's aspect ratio is preserved when used in conjunction with transform-max-width
  • transform-format:
    • no attribute: use the default (form-level then property)
    • blank attribute value: preserve the input format
    • jpg: force the result to JPEG
    • png: force the result to PNG
  • transform-quality:
    • no attribute: use the default (form-level then property)
    • blank attribute value: use the default compression quality (80)
    • for JPEG compression only
    • value between 1 (worst) and 100 (best), but typically between 50 and 90
The following matching properties allow setting global defaults. For example:
1
<property
2
as="xs:string"
3
name="oxf.xforms.xbl.fr.image-attachment.transform-max-width.*.*"
4
value="1024"/>
5
<property
6
as="xs:string"
7
name="oxf.xforms.xbl.fr.image-attachment.transform-max-height.*.*"
8
value="768"/>
9
<property
10
as="xs:string"
11
name="oxf.xforms.xbl.fr.image-attachment.transform-format.*.*"
12
value="jpg"/>
13
<property
14
as="xs:string"
15
name="oxf.xforms.xbl.fr.image-attachment.transform-quality.*.*"
16
value="90"/>
Copied!

Form Builder customer settings

When used in Form Builder, the following custom settings for image transformation are available:
Custom settings

See also

Last modified 3mo ago