The easiest way to access the images is through the ODK Aggregate URL for
accessing attachments.
The database tables are structured so that unbounded-size images can be
stored in the database. If your image size is under 1 MB, it is stored in
one data record, but if you have larger image files (or longer streaming
videos), they are split across multiple blob records, and writing the logic
to reconstruct them will be error-prone.
The ODK Aggregate URL for, e.g., the GeoTagger form on
opendatakit.appspot.com, looks like:
http://opendatakit.appspot.com/view/binaryData?blobKey=geo_tagger_v2[%40version%3Dnull+and+%40uiVersion%3Dnull]%2Fgeotagger[%40key%3Duuid%3Af6454ba6-2485-426f-8e1a-8981e463e6fe]%2FImage&previewImage=true
If you want a small thumbnail, specify previewImage=true (as above).
If you want to download it as an attachment (or access the original
filename), you can also specify as_attachment=true, in which case it will
supply the filename as originally uploaded.
The blobKey identifies the image. As with all URLs, the parameters are
URLEncoded which makes them very ugly. The URLDecoded blobKey looks like:
geo_tagger_v2[@version=null and
@uiVersion=null]/geotagger[@key=uuid:f6454ba6-2485-426f-8e1a-8981e463e6fe]/Image
This is an XPath-style naming for the image element in the Xform. It
identifies the form id: get_tagger_v2, the version and uiVersion values
(from the attributes on the Xform's top-level element), the name of the
top-level element in the form (geotagger), the primary key for the
submission being referenced (uuid:f6454ba6-2485-426f-8e1a-8981e463e6fe) and
the XPath within the form to the image. In this case, the image (field
name Image) is immediately underneath the top-level element in the form.
If you had repeat groups, you would have to specify the ordinal (1..n) of
the repeat group. So for the first repeat group, you would have:
.../repeatElement[@ordinal=1]/Image
and for the 5th repeat, you would specify:
.../repeatElement[@ordinal=5]/Image
Mitch
···
On Mon, Jan 30, 2012 at 9:24 AM, Feltpad Incorporated wrote:
We have installed ODK Aggregate and we are using a MySQL Database.
I can see the data inside the _PHOTO_BIN, _PHOTO_BN, and PHOTO_REF
tables - but how do I read this data and display the image? I see in
the _PHOTO_BN table there is a field named UNROOTED_FILE_PATH which
contains a .jpg filename, but I don't know if this can actually be
used to access the image?
Thank you.
--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en
--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com