Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 通过安全域从Instagram Gem中提取图像_Ruby On Rails_Ruby_Instagram - Fatal编程技术网

Ruby on rails 通过安全域从Instagram Gem中提取图像

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 gem从API中提取信息,但我的浏览器控制台中出现了一个错误,因为这些图像是通过HTTPS站点上的HTTP传输的

看法 初始值设定项
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?\:/, '') %>