README.md in hydra-derivatives-0.1.1 vs README.md in hydra-derivatives-1.0.0.beta1
- old
+ new
@@ -5,26 +5,26 @@
If you have an ActiveFedora class like this:
```ruby
class GenericFile < ActiveFedora::Base
include Hydra::Derivatives
- has_file_datastream :content
+ contains 'content'
attr_accessor :mime_type
# Use a block to declare which derivatives you want to generate
makes_derivatives do |obj|
case obj.mime_type
when 'application/pdf'
- obj.transform_datastream :content, { :thumb => "100x100>" }
+ obj.transform_file :content, { :thumb => "100x100>" }
when 'audio/wav'
- obj.transform_datastream :content, { :mp3 => {format: 'mp3'}, :ogg => {format: 'ogg'} }, processor: :audio
+ obj.transform_file :content, { :mp3 => {format: 'mp3'}, :ogg => {format: 'ogg'} }, processor: :audio
when 'video/avi'
- obj.transform_datastream :content, { :mp4 => {format: 'mp4'}, :webm => {format: 'webm'} }, processor: :video
+ obj.transform_file :content, { :mp4 => {format: 'mp4'}, :webm => {format: 'webm'} }, processor: :video
when 'image/png', 'image/jpg'
- obj.transform_datastream :content, { :medium => "300x300>", :thumb => "100x100>" }
+ obj.transform_file :content, { :medium => "300x300>", :thumb => "100x100>" }
when 'image/tiff'
- obj.transform_datastream :content, { :service => { resize: "3600x3600>" } }, processor: 'jpeg2k_image'
+ obj.transform_file :content, { :service => { resize: "3600x3600>" } }, processor: 'jpeg2k_image'
end
end
end
```
@@ -32,28 +32,28 @@
```ruby
class GenericFile < ActiveFedora::Base
include Hydra::Derivatives
- has_file_datastream :content
+ contains 'content'
attr_accessor :mime_type
# Use a callback method to declare which derivatives you want
makes_derivatives :generate_derivatives
def generate_derivatives
case mime_type
when 'application/pdf'
- transform_datastream :content, { :thumb => "100x100>" }
+ transform_file :content, { :thumb => "100x100>" }
when 'audio/wav'
- transform_datastream :content, { :mp3 => {format: 'mp3'}, :ogg => {format: 'ogg'} }, processor: :audio
+ transform_file :content, { :mp3 => {format: 'mp3'}, :ogg => {format: 'ogg'} }, processor: :audio
when 'video/avi'
- transform_datastream :content, { :mp4 => {format: 'mp4'}, :webm => {format: 'webm'} }, processor: :video
+ transform_file :content, { :mp4 => {format: 'mp4'}, :webm => {format: 'webm'} }, processor: :video
when 'image/png', 'image/jpg'
- transform_datastream :content, { :medium => "300x300>", :thumb => {size: "100x100>", datastream: 'thumbnail'} }
+ transform_file :content, { :medium => "300x300>", :thumb => {size: "100x100>", datastream: 'thumbnail'} }
when 'image/tiff'
- transform_datastream :content, { :service => { recipe: :default } }, processor: 'jpeg2k_image'
+ transform_file :content, { :service => { recipe: :default } }, processor: 'jpeg2k_image'
end
end
end
```
@@ -64,10 +64,10 @@
obj.content.content = File.open(...)
obj.mime_type = 'image/jpg'
obj.save
```
-Then when you call `obj.create_derivatives` two new datastreams, 'thumbnail' and 'content_medium', will have been created with downsized images in them.
+Then when you call `obj.create_derivatives` two new files, 'thumbnail' and 'content_medium', will have been created with downsized images in them.
We recommend you run `obj.create_derivatives` in a background worker, because some derivative creation (especially videos) can take a long time.
# Installation