Ruby on rails 通过安全域从Instagram Gem中提取图像
我正在使用Instagram gem从API中提取信息,但我的浏览器控制台中出现了一个错误,因为这些图像是通过HTTPS站点上的HTTP传输的 看法 初始值设定项Ruby on rails 通过安全域从Instagram Gem中提取图像,ruby-on-rails,ruby,instagram,Ruby On Rails,Ruby,Instagram,我正在使用Instagram gem从API中提取信息,但我的浏览器控制台中出现了一个错误,因为这些图像是通过HTTPS站点上的HTTP传输的 看法 初始值设定项 Instagram将通过http和https提供资产服务,因此只需调整您的URL即可。可以将URL协议设置为相对协议,以便始终使用正确的协议在浏览器中加载图像。在您的视图中尝试以下操作: <%= image_tag i.images.standard_resolution.url.sub(/^https?\:/, '') %&g
Instagram将通过http和https提供资产服务,因此只需调整您的URL即可。可以将URL协议设置为相对协议,以便始终使用正确的协议在浏览器中加载图像。在您的视图中尝试以下操作:
<%= image_tag i.images.standard_resolution.url.sub(/^https?\:/, '') %>
def instagram Instagram.user_recent_media("xxxxxx", {:count => 6})
rescue nil
end
require "instagram"
Instagram.configure do |config|
config.client_id = "xxx"
config.access_token = "xxx"
end
<%= image_tag i.images.standard_resolution.url.sub(/^https?\:/, '') %>