0

I am using file picker to upload an image to my rails app, and then on the show page I have a button that allows them to open the image to edit it inside of aviary.

The editor will open, but closes right after it displays for just a moment. Here is the error in the console:

Resource interpreted as Script but transferred with MIME type text/html:

Here is the code as it is now:

<%= 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 %>
Aaron Mills
  • 172
  • 1
  • 14
  • 1
    Link to read up on - http://stackoverflow.com/questions/11988437/im-getting-the-message-resource-interpreted-as-script-but-transferred-with-mime – Deej May 29 '13 at 18:31

2 Answers2

0
This line needed to change 

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

To this: 

<%= @user.filepicker_url %>
ChrisF
  • 134,786
  • 31
  • 255
  • 325
Aaron Mills
  • 172
  • 1
  • 14
0

Ok here is where I made another change and it is now working.. accept that the saved file doesn't change the thumbnail version???

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

Why don't all versions of the filepicker.io file get modified?

Aaron Mills
  • 172
  • 1
  • 14