【问题标题】:UploadCare doesn't load image in dialogUploadCare 不在对话框中加载图像
【发布时间】:2014-12-23 02:58:58
【问题描述】:

我希望 UploadCare 对话框在单击 MyButton 后打开,显示 Twitter 徽标,但它没有。为什么不呢?

$('#MyButton').on('click', function() {
    uploadcare.openDialog('https://g.twimg.com/About_logoUsage.png');
    return false;
});

【问题讨论】:

    标签: javascript uploadcare


    【解决方案1】:

    您需要将file 对象作为参数传递给openDialog 方法。可以通过调用uploadcare.fileFrom方法获取文件对象:

    // Pre-load an image from arbitrary URL,
    // and open Uploadcare file upload dialog
    $('#MyButton').on('click', function() {
        var file = uploadcare.fileFrom('url', 'https://g.twimg.com/About_logoUsage.png');
        uploadcare.openDialog(file);
        return false;
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-04-16
      • 2014-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-10
      相关资源
      最近更新 更多