Module: PdfCover::ClassMethods::CarrierWave
- Defined in:
- lib/pdf_cover.rb
Instance Method Summary collapse
-
#pdf_cover_attachment(options = {}) ⇒ Object
When called in the context of a CarrierWave::Uploader::Base subclass, this method will add a processor to the currenct attachment or version that generates a JPEG with 95 quality from the first page of the given PDF.
Instance Method Details
#pdf_cover_attachment(options = {}) ⇒ Object
When called in the context of a CarrierWave::Uploader::Base subclass, this method will add a processor to the currenct attachment or version that generates a JPEG with 95 quality from the first page of the given PDF.
This will not make any validation on the given content type, you must [do it yourself](github.com/carrierwaveuploader/carrierwave#securing-uploads) on your uploader.
32 33 34 35 36 37 38 39 |
# File 'lib/pdf_cover.rb', line 32 def ( = {}) process pdf_cover: [[:quality], [:resolution]] process enforce_content_type: "image/jpeg" define_method :full_filename do |for_file = model.logo.file| for_file.gsub(/pdf$/i, "jpeg") end end |