简体   繁体   中英

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.

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

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

or

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM