Sign or annotate a fixed image specified in the form definition describes a feature that would allow form designers to specify an image to be annotated or signed.
There have been two different approaches proposed for adding support for this in the ODK XForms spec.
Use defaults
One idea brought up by @Grzesiek2010 in https://github.com/opendatakit/collect/pull/2428 is to use the standard default value mechanism. This doesn't currently work for binary files (as described below) but it could be a way to support annotation/signature of fixed images without adding any form spec changes.
As stated in the specification, "Any value inside a primary instance is considered a default value for that question. If that node has a corresponding input element that value will be displayed to the user when the question is rendered." However, this is not currently true for questions of type binary
. This is because clients typically (always?) see the following as different and saves them in different places:
- media attached to the form that can be used to, for example, illustrate a question or lookup a value
- media attached to a filled form that will be sent to the server with a submission
That means that if a form's primary instance contains the following: <my_image>my_face.jpg</my_image>
, the client won't find my_face.jpg
in media attached to the current filled form and so the default value won't be recognized. This is true even if the user uploads a media file with filename my_face.jpg
alongside the form definition. However, if the user selects an image called my_face.jpg
from their client, <my_image>my_face.jpg</my_image>
will now be a valid part of the primary instance.
It's weird that defaults work for all types except for media (binary
). One way to make this more consistent would be for clients, when they see a question of binary
type with a filename value, to look in the directory for the current filled form for that image (current behavior) and if it's not found, look in the directory for media attached to the corresponding blank form and make a copy to the filled form directory.
One question about this is whether defaults should also be allowed for audio, video, raw images, etc. I think so for consistency even though it's unlikely to be all that useful.
Use the image label or introduce a new attribute
As described by Mitch in https://github.com/opendatakit/collect/issues/84. This would more closely match how media files are added to a form for illustration purposes (images, audio, video).
Another related option would be to introduce an appearance such as markup
that combines with annotate
or signature
and hides the buttons to select or capture a new image while also using the label image for the annotation.
No matter the spec option we choose, we'll probably want an appearance to hide the images for taking and choosing images.