Browse Source

Static maps ssl issue

development
Godwin 11 years ago
parent
commit
7ed0d8c882
  1. 2
      app/helpers/application_helper.rb

2
app/helpers/application_helper.rb

@ -445,7 +445,7 @@ module ApplicationHelper
file = File.join("public", "maps/#{local_file_name}") file = File.join("public", "maps/#{local_file_name}")
FileUtils.mkdir_p("public/maps") unless File.directory?("public/maps") FileUtils.mkdir_p("public/maps") unless File.directory?("public/maps")
if !File.exist?(file) if !File.exist?(file)
url = "http://maps.googleapis.com/maps/api/staticmap?center=#{location}&zoom=#{zoom}&size=#{width}x#{height}&maptype=roadmap&markers=size:small%7C#{location}&key=AIzaSyAH7U8xUUb8IwDPy1wWuYGprzxf4E1Jj4o" url = "https://maps.googleapis.com/maps/api/staticmap?center=#{location}&zoom=#{zoom}&size=#{width}x#{height}&maptype=roadmap&markers=size:small%7C#{location}&key=AIzaSyAH7U8xUUb8IwDPy1wWuYGprzxf4E1Jj4o"
require 'open-uri' require 'open-uri'
open(file, 'wb') do |f| open(file, 'wb') do |f|
f << open(url).read f << open(url).read

Loading…
Cancel
Save