Skip to content
Snippets Groups Projects
Commit 44196cd9 authored by Stephen D's avatar Stephen D
Browse files

Favicons

parent baf65901
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,16 @@ class ImageUploader < CarrierWave::Uploader::Base
# # do something
# end
def efficient_conversion(width, height)
manipulate! do |img|
img.format("png") do |c|
c.resize "#{width}x#{height}>"
c.resize "#{width}x#{height}<"
end
img
end
end
#Max size
process resize_to_limit: [2000, 2000]
......@@ -40,6 +50,16 @@ class ImageUploader < CarrierWave::Uploader::Base
process resize_to_limit: [300, 300]
end
version :icon do
process efficient_conversion: [256, 256]
def png_url
return nil if self.url.nil?
#mega hack
self.url[0..-4] + "png"
end
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_whitelist
......
......@@ -11,6 +11,10 @@
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<% unless current_blog.nil? || current_blog.logo.icon.url.nil? %>
<%= favicon_link_tag current_blog.logo.icon.png_url %>
<% end %>
<%= yield :head %>
</head>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment