How can one properly validate image questions such that it only accept jpg or jpeg only,the image size not more than 100kb.
I also want the upload button disabled,we prefer the direct capturing.
Thank you
How can one properly validate image questions such that it only accept jpg or jpeg only,the image size not more than 100kb.
I also want the upload button disabled,we prefer the direct capturing.
Thank you
Hi Valentine_Onuchukwu,
To restrict uploading of a new image, use 'new' under appearance for the image question
To restrict the quality and size, use the 'max-pixels = 100' to restrict the longest image width to 100 pixels.
ODK saves images captured in jpg format.
More details in the documentation https://docs.getodk.org/form-question-types/#image-widgets
If you wish to restrict the precise file size (not image dimension size!) to 100kb, then you will probably need to tweak the provided max-pixels
dimension to something the produces a JPEG that will reliably be under your 100kB limit. Note, because JPEG uses a variable-sized compression algorithm, the exact max-pixels
dimension that result in 100kb is somewhat unpredictable... [although there are a few online tools that will try to compress to approximately a specific size...].
So your best bet might be to try out a few of your expected images, and pick a max-pixels
that will give you something small enough to fit your needs.