如何将已经上传的图像的URL添加到Dropzone? [英] How to add the URL of an image already uploaded, to Dropzone?

查看:277
本文介绍了如何将已经上传的图像的URL添加到Dropzone?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我检索了已经上传到网站的图像的URL.如何以编程方式将此图像添加到我的Dropzone组件中并立即查看其预览?我尝试了以下代码,但未显示图像:

I've retrieved the URL of an image which has already been uploaded to a website. How can I programmatically add this image to my Dropzone component and see its preview instantly? I tried the following code but the image was not shown:

var mockFile = { name: "image.jpg", size: 12345 };
imgUrl = "http://example.com/image.jpg"
myDropzone.options.addedfile.call(myDropzone, mockFile, imgUrl);

推荐答案

您需要触发另一个事件:thumbnail 我无法检查代码,但应该是这样的:

You need to fire another event: thumbnail I can't check code but it should be something like this:

var mockFile = { name: "image.jpg", size: 12345 };
imgUrl = "http://example.com/image.jpg"
myDropzone.options.addedfile.call(myDropzone, mockFile);
myDropzone.options.thumbnail.call(myDropzone, mockFile, imgUrl);

这篇关于如何将已经上传的图像的URL添加到Dropzone?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆