@@ -60,4 +60,11 @@ module ApplicationHelper
|
||||
def kaminari_path(url)
|
||||
"#{root_url.chomp("\/")}#{url}"
|
||||
end
|
||||
|
||||
def self.asset_data_base64(path)
|
||||
asset = Rails.application.assets.find_asset(path)
|
||||
throw "Could not find asset '#{path}'" if asset.nil?
|
||||
base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "")
|
||||
"data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user