简体   繁体   English

用相机拍照并用GWT上传器发送

[英]Take picture with camera and send with GWT uploader

I am creating the image uploading form using GWT Uploader library. 我正在使用GWT Uploader库创建图像上传表单。 http://www.moxiegroup.com/moxieapps/gwt-uploader/ 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: 据我所知,可以使用以下HTML代码完成此操作:

<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. 它应该生成HTML格式的Input组件,该组件接受图像,并且重要的是capture参数告诉浏览器应该启动相机拍摄照片。

Is there any way, how to make the library generate the input with capture parameter? 有什么办法,如何使库生成带有capture参数的输入? I studied API of GWT Uploader and found out, that it is a wrapper for another library SWFUpload. 我研究了GWT Uploader的API,发现它是另一个库SWFUpload的包装。 I studied also API of this one, but did not find anything useful. 我也研究了这个API,但是没有发现任何有用的东西。

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. 在开始破解生成的代码并使用DOM进行操作之前,我想知道是否有更标准的方法来实现它。

You can add any attribute to any widget/element in GWT: 您可以将任何属性添加到GWT中的任何小部件/元素:

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

or 要么

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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