Skip to content

Commit

Permalink
Add workaround for cloudfront issues w/ img/vid
Browse files Browse the repository at this point in the history
Supports #245
  • Loading branch information
walter committed Jan 25, 2014
1 parent e41f1db commit a248883
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ def cdn_image_tag(url, opts = {})
width, height = opts[:width], opts[:height]
end

return image_tag(url, opts) if Rails.env.development?

url = "http:#{url}" if url.present? && url[0..1] == "//"

if url.blank? || (url.include? 'ballotpedia')
image_tag("/assets/placeholder.png")
else
return image_tag(url, opts) if (width.blank? || height.blank?) ||
Rails.env.development?

image_tag("http://d2xfsikitl0nz3.cloudfront.net/#{CGI.escape(url)}/#{width}/#{height}", opts)
end
end
Expand All @@ -157,10 +158,11 @@ def cdn_video_tag(url, opts = {})
width, height = opts[:width], opts[:height]
end

return video_tag(url, opts) if Rails.env.development?
return video_tag(url, opts) # if Rails.env.development?

url = "http:#{url}" if url.present? && url[0..1] == "//"
video_tag("http://d2xfsikitl0nz3.cloudfront.net/#{CGI.escape(url)}", opts)
# url = "http:#{url}" if url.present? && url[0..1] == "//"
# cloudfront backed vide
# video_tag("http://d2xfsikitl0nz3.cloudfront.net/#{CGI.escape(url)}", opts)
end

# Returns an "a" tag for the navigation tab.
Expand Down

0 comments on commit a248883

Please sign in to comment.