Skip to content

Instantly share code, notes, and snippets.

@prsanjay
Created June 30, 2019 07:20
Show Gist options
  • Save prsanjay/205a33ece291d98ecf249470a42ebd98 to your computer and use it in GitHub Desktop.
Save prsanjay/205a33ece291d98ecf249470a42ebd98 to your computer and use it in GitHub Desktop.
Style configuration for taxon header image
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