An Analyser analyses a particular property of a piece of content, e.g. the width of an image, the bitrate of an audio file, etc.
One can be added using a block
or providing an object that responds to
MyAnalyser in this case)
Using the analyser
The analyser is available as a method to
Implementing the analyser
content object yielded to the block/
call method is a Dragonfly::Content - see the doc for methods it provides.
Returning the property
Simply return the calculated property. You will probably want to use one of the
Content methods for getting the data such as
Using shell commands
To use the shell, you can use
path above will always exist.
Using pre-registered analysers
To use a pre-registered analyser, use
The ImageMagick plugin adds a few analysers - see the doc for more details.
“Magic” Model Attributes
To automatically store analysed properties in your model see Models - Magic Attributes