javahtmlgwtcameraswfupload

Take picture with camera and send with GWT uploader


I am creating the image uploading form using GWT Uploader library. http://www.moxiegroup.com/moxieapps/gwt-uploader/

There is a requirement, that user should be able to use camera on his mobile device or webcamera to create the picture. As far as I know, this can be done using this HTML code:

<input type="file" name="image" accept="image/*" capture>

It should generate Input component of a HTML form which accepts images and what is important - capture parameter tells to the browser, that it should start camera to take the picture.

Is there any way, how to make the library generate the input with capture parameter? I studied API of GWT Uploader and found out, that it is a wrapper for another library SWFUpload. I studied also API of this one, but did not find anything useful.

Before I start hacking the generated code and manipulate with DOM, I would like to know, if there is more standard way to achieve it.


Solution

  • You can add any attribute to any widget/element in GWT:

    myWidget.getElement().setAttribute("capture", "camera");
    

    or

    myWidget.getElement().setAttribute("accept", "image/*;capture=camera");