Git Product home page Git Product logo

Comments (3)

andrewhood125 avatar andrewhood125 commented on September 26, 2024

So I wanted to use multiple sources and be able to specify each one from the helper. We have some assets in s3 and some in our repo.

Long story short, the multiple hosts are for sharding. imgix-rails doesn't have any hand in it, it comes from the underlying imgix gem. PR is here: https://github.com/imgix/imgix-rb/pull/3/files and there are some docs in the imgix-rb repo about the motivation behind sharding.

from imgix-rails.

piya23300 avatar piya23300 commented on September 26, 2024

I'm confused too.

How to use it?

Rails.application.configure do
  config.imgix = {
    sources: {
      "assets_foobarbaz.imgix.net"  => "foobarbaz",
      "assets_nil.imgix.net" => nil,   # Will generate unsigned URLs
    },
    default_source: "default_source.imgix.net"
  }
end
include Imgix::Rails::UrlHelper

puts ix_image_url('/users/1/avatar.png', { w: 400, h: 300 })
# => https://assets_nil.imgix.net/users/1/avatar.png?w=400&h=300

I expet to use below but it's not work T.T

puts ix_image_url('foobarbaz', '/users/1/avatar.png', { w: 400, h: 300 })
# I expect
# => https://assets_foobarbaz.imgix.net/users/1/avatar.png?w=400&h=300
# It shows an error
# =>  Unknown source 'foobarbaz'

Can someone help me?

from imgix-rails.

sherwinski avatar sherwinski commented on September 26, 2024

Closing as this issue is quite old. If anyone still has questions about multi-source support, please feel free to comment here or open a new issue altogether.

from imgix-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.