2013-05-29 182 views
0

我正在使用文件选取器将图像上传到我的rails应用程序,然后在显示页面上我有一个按钮,允许它们打开图像以在鸟舍内进行编辑。鸟舍关闭后立即关闭

编辑器将会打开,但在显示一会之后立即关闭。下面是在控制台中错误:

资源解释为脚本,但使用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 %> 
+1

Link to read on - http://stackoverflow.com/questions/11988437/im-getting-the-message-resource-interpreted-as-script-but-transferred-with-mime – David

+0

谢谢,这帮了我了解问题。 –

回答

0
This line needed to change 

<%= @user.filepicker_url %>+.jpg 

To this: 

<%= @user.filepicker_url %> 
+0

你应该为你的后续问题提出一个新问题。 – ChrisF

0

确定这里是我做了另一个改变,现在正在工作..接受保存的文件不会改变缩略图的版本?

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

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