开发者

Rails app - Accessing image in adobe edge java script file through amazon s3

开发者 https://www.devze.com 2023-03-29 06:26 出处:网络
I am hosting a rails application on Heroku. To reduce slug size I have moved all public folder files to Amazon S3 through the jammit-s3 gem. Everything worked perfect. My application can access and di

I am hosting a rails application on Heroku. To reduce slug size I have moved all public folder files to Amazon S3 through the jammit-s3 gem. Everything worked perfect. My application can access and display images, js & css files from s3, but there is one problem.

I 开发者_如何学运维am using Adobe Edge (new HTML5 tool for animations) for an image gallery in my application. Adobe Edge automatically creates some javascript & css files. Part of one javascript file (public/javascripts/x.js) is as follows:

content: {
  dom: [
    {
        id:'Image1',

        type:'image',
        rect:[0,0,600,400],
        fill:['rgba(0,0,0,0)','../images/schimg1.png'],
    },

As you can see it is taking schimg1.png (public/images/) as a parameter. Before moving my files to S3, the javascript could access the image and display it by going one folder up and accessing the images. But after moving to S3, this is not working anymore. When I hosted the public folder on Heroku it worked fine.

Any idea how I can fix this? I would appreciate a solution that doesn't involve major modifications to the javascript, since it is automatically generated.


'../images/schimg1.png' is a relative path, which will work if the images are in your Heroku slug, and in the right place on the heroku app server.

If your images are on S3, then you'll have to change it to:

'http://myamazons3.account.subdomain/pathtoimage/schimg1.png'

0

精彩评论

暂无评论...
验证码 换一张
取 消