diff --git a/app/models/site_upload.rb b/app/models/site_upload.rb index b3926ec7ed..6431d1007d 100644 --- a/app/models/site_upload.rb +++ b/app/models/site_upload.rb @@ -26,8 +26,23 @@ class SiteUpload < ApplicationRecord APP_ICON_SIZES = (APPLE_ICON_SIZES + ANDROID_ICON_SIZES).uniq.freeze STYLES = { - app_icon: APP_ICON_SIZES.each_with_object({}) { |size, hash| hash[size.to_s.to_sym] = "#{size}x#{size}#" }.freeze, - favicon: FAVICON_SIZES.each_with_object({}) { |size, hash| hash[size.to_s.to_sym] = "#{size}x#{size}#" }.freeze, + app_icon: + APP_ICON_SIZES.to_h do |size| + [:"#{size}", { format: 'png', geometry: "#{size}x#{size}#", file_geometry_parser: FastGeometryParser }] + end.freeze, + + favicon: { + ico: { + format: 'ico', + geometry: '48x48#', + file_geometry_parser: FastGeometryParser, + }.freeze, + }.merge( + FAVICON_SIZES.to_h do |size| + [:"#{size}", { format: 'png', geometry: "#{size}x#{size}#", file_geometry_parser: FastGeometryParser }] + end + ).freeze, + thumbnail: { '@1x': { format: 'png', diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 56857b2b63..e3d05226ee 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -11,7 +11,7 @@ - if storage_host? %link{ rel: 'dns-prefetch', href: storage_host }/ - %link{ rel: 'icon', href: site_icon_path('favicon') || '/favicon.ico', type: 'image/x-icon' }/ + %link{ rel: 'icon', href: site_icon_path('favicon', 'ico') || '/favicon.ico', type: 'image/x-icon' }/ - SiteUpload::FAVICON_SIZES.each do |size| %link{ rel: 'icon', sizes: "#{size}x#{size}", href: site_icon_path('favicon', size.to_i) || frontend_asset_path("icons/favicon-#{size}x#{size}.png"), type: 'image/png' }/ diff --git a/config/imagemagick/policy.xml b/config/imagemagick/policy.xml index e2aa202f27..2730a9f84e 100644 --- a/config/imagemagick/policy.xml +++ b/config/imagemagick/policy.xml @@ -23,5 +23,5 @@ - +