Created
June 30, 2019 07:20
-
-
Save prsanjay/205a33ece291d98ecf249470a42ebd98 to your computer and use it in GitHub Desktop.
Style configuration for taxon header image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Spree | |
class TaxonHeaderImage < Asset | |
module Configuration | |
module Paperclip | |
extend ActiveSupport::Concern | |
included do | |
def self.styles | |
attachment_definitions[:attachment][:styles] | |
end | |
delegate :url, to: :attachment | |
has_attached_file :attachment, | |
styles: { normal: '970>x140' }, | |
default_style: :normal, | |
convert_options: { all: '-strip -colorspace sRGB -interlace Plane -quality 60' }, | |
s3_headers: { 'Cache-Control' => 'max-age=2592000,public', 'Expires' => 10.years.from_now.httpdate } | |
validates_attachment :attachment, | |
content_type: { content_type: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif'] } | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment