Class: Paperclip::MetadataExtractor
- Inherits:
-
Processor
- Object
- Processor
- Paperclip::MetadataExtractor
- Defined in:
- lib/paperclip_processors/metadata_extractor.rb
Instance Method Summary collapse
Instance Method Details
#make ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/paperclip_processors/metadata_extractor.rb', line 16 def make # get the metadata from Yamdi = Yamdi.new(file.path) # add values to the attachment instance (for db persistence, etc) # assumes duration is a column in the table this attachment is being # added to. # a simple assignment works if you are not background processing your # paperclip processing .instance.duration = .duration # if you are background processing your paperclip processing which is # common when working with videos you'll want to ensure the instance gets # saved at some point in the processor chain, use: # attachment.instance.update_attribute(:duration, metadata.duration) # always return a reference to the file when done file end |