Sha256: c8bab43414d80c576abe05a37912d87c70c8214c3c42d0268ff92d0725b2d2c2
Contents?: true
Size: 1.98 KB
Versions: 3
Compression:
Stored size: 1.98 KB
Contents
# GenericImage: # EXAMPLE Model that conforms to the Hydra genericImage, genericMetadata and genericContent cModels # # Default content datastreams: content, original (optional), max, thumbnail, screen # # Sample Usages: # From file: # my_image = File.new("#{Rails.root}/spec/fixtures/image.tiff") # gi = GenericImage.new # gi.content=my_image # gi.save # # From url: # my_image = "http://example.com/path/to/some/image.jpeg" # gi = HydraImage.new # gi.content=my_image # # From binary string: # my_image = File.open("#{Rails.root}/spec/fixtures/image.tiff") # my_blob = my_image.read # gi = HydraImage.new # gi.content={ :blob=> my_blob, :extension => ".tiff" } # # To create the derived images: # gi.derive_all # creates max, screen and thumbnail from content datastream # gi.derive_max # gi.derive_screen # gi.derive_thumbnail # # To get the content of a default datastream: # max = gi.max # screen = gi.screen # thumbnail = gi.thumbnail # # To determine if a particular datastream exists for an image: # gi.has_content? # gi.has_original? # gi.has_max? # gi.has_screen? # gi.has_thumbnail? require 'hydra' class GenericImage < ActiveFedora::Base # Uses the GenericImage mixin to conform to the Hydra genericImage cModel (auto-includes on GenericContent behaviors) include Hydra::GenericImage # adds helpful methods for basic hydra objects include Hydra::ModelMethods # Uses the Hydra Rights Metadata Schema for tracking access permissions & copyright # FIXME: should this have "include Hydra::ModelMixins::CommonMetadata" instead? has_metadata :name => "rightsMetadata", :type => Hydra::Datastream::RightsMetadata has_metadata :name => "descMetadata", :type => Hydra::Datastream::ModsImage # A place to put extra metadata values, e.g. the user id of the object depositor (for permissions) has_metadata :name => "properties", :type => Hydra::Datastream::Properties def initialize( attrs={} ) super end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hydra-head-4.0.3 | app/models/generic_image.rb |
hydra-head-4.0.2 | app/models/generic_image.rb |
hydra-head-4.0.1 | app/models/generic_image.rb |