【问题标题】:Aviary closes right after it opens鸟舍在打开后立即关闭
【发布时间】:2013-05-29 17:53:39
【问题描述】:

我正在使用文件选择器将图像上传到我的 rails 应用程序,然后在显示页面上我有一个按钮,允许他们打开图像以在 aviary 内对其进行编辑。

编辑器将打开,但在显示片刻后立即关闭。这是控制台中的错误:

资源解释为脚本但以 MIME 类型 text/html 传输:

这是现在的代码:

<%= javascript_tag do %>
        //Setup Filepicker.io - to get an apikey, go to https://developers.filepicker.io/register/
        filepicker.setKey('Ao6qJVzzAQ5K8zL6UUhxKz');

        //Setup Aviary
        var featherEditor = new Aviary.Feather({
            //Get an api key for Aviary at http://www.aviary.com/web-key
            apiKey: 'jdbk5iwjxibpotfn',
            apiVersion: 2,
            onSave: function(imageID, newURL) {
                //Export the photo to the cloud using Filepicker.io!
                filepicker.export(newURL, {extension:'.png'});
            },
            appendTo: 'web_demo_pane'
        });

        //Giving a placeholder image while Aviary loads
        var preview = document.getElementById('web_demo_preview');
        var editPane = document.getElementById('start_web_demo');
        editPane.onclick = function(){
        //When the user clicks the button, import a file using Filepicker.io
        var theurl = "<%= @user.filepicker_url %>+.jpg";
        preview.src = theurl;
                featherEditor.launch({
                    image: preview,
                    url: theurl
                });
    };

    <% end %>

【问题讨论】:

标签: javascript ruby-on-rails-3 filepicker.io aviary


【解决方案1】:

好的,这是我进行另一项更改的地方,它现在正在工作.. 接受保存的文件不会更改缩略图版本???

//filepicker.store(newURL);
$.post(oldurl, {url: newURL}, function(response){console.log(response);});

为什么不是所有版本的 filepicker.io 文件都被修改?

【讨论】:

    【解决方案2】:
    This line needed to change 
    
    <%= @user.filepicker_url %>+.jpg
    
    To this: 
    
    <%= @user.filepicker_url %>
    

    【讨论】:

    • 您应该针对后续问题提出一个新问题。
    猜你喜欢
    • 2014-06-14
    • 2017-08-20
    • 2017-11-21
    • 2014-11-23
    • 2018-05-02
    • 2016-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多