如何将服务器上的图片添加到 drupal 7 的文件图像字段中?
我需要将网络摄像头的图像添加到 drupal 7 节点创建页面上的图像字段。我已经有了将图像从网络摄像头存储到服务器的程序。现在,如何在创建节点表单的图像字段中显示它?
我需要它,以便用户可以删除/移动它,然后保存节点。
我找到了这个模块 http://drupal.org/project/filefield_sources 但我真的不知道了解它对我有什么帮助...
I need to add the image from webcam to image field on drupal 7 node creation page. I have already the procedure, which stores the image from webcam to the server. Now, how can I show it in image field of create node form?
I need it, so the user can delete/move it and then save the node.
I've found this module http://drupal.org/project/filefield_sources but I don't really understand how could it help me...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜您正在尝试让用户选择表单的图像。为此,您将无法使用标准
字段,因为出于浏览器安全性的原因,您无法访问该字段并填充它,或者其他什么。
因此,您必须
select
控件,该控件列出允许用户从中选择的图像<输入类型=“文件”>
控制。有很多方法可以解决这个问题,其中一个例子是:使用不可编辑的文本框()、虚假浏览按钮(
< ;button>Browse
),并使用一个模式来显示可用图像的预览,用户可以单击以进行选择。它实际上应该不会太糟糕/很难完成,只是涉及编写更多代码,因为您无法使用本机文件浏览器。
希望有帮助。
I gather you're trying to let the user select the image for the form. To accomplish this, you're not going to be able to use a standard
<input type="file">
field, because due to browser security, you're not allowed to access that field and populate it, or anything.So, instead, you're going to have to either
select
control which lists the images the user is allowed to choose from<input type="file">
control. There's a lot of ways you could go about this, an example of one would be: use an uneditable textbox (<input type="text" disabled>
), faux browse button (<button>Browse</button>
), and use a modal that shows previews of available images which the user can click to select.It shouldn't really be too bad/hard to accomplish, just involves writing more code since you can't use the native file browser.
Hope that helps.