Class: StaticImageAggregator

Inherits:
ResourceAggregator show all
Defined in:
app/models/static_image_aggregator.rb

Constant Summary collapse

CUL_WIDTH =
"http://purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/imageWidth"
CUL_LENGTH =
"http://purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/imageLength"

Instance Method Summary collapse

Methods included from Cul::Hydra::Models::LinkableResources

#audio_resource, #basic_resource, #http_client, #image_resource, #linkable_resources

Methods included from Cul::Hydra::Fedora::UrlHelperBehavior

#fedora_ds_url, #fedora_method_url, #fedora_object_url, #fedora_risearch_url, #fedora_url, #pid_for_url

Methods included from Cul::Hydra::Models::Aggregator

#add_member, #has_struct_metadata?, #member_ids, #members, #remove_member, #solr_members

Methods included from Cul::Hydra::Models::Common

#cmodel_pid, #datastreams_in_fedora, #get_representative_generic_resource, #has_desc?, #initialize, #label=, #rdf_type, #rdf_types!, #set_size_labels, #to_solr, #update_datastream_attributes

Instance Method Details

#index_type_labelObject



12
13
14
# File 'app/models/static_image_aggregator.rb', line 12

def index_type_label
  'PART'
end

#route_asObject



8
9
10
# File 'app/models/static_image_aggregator.rb', line 8

def route_as
  "image"
end

#thumbnail_infoObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/models/static_image_aggregator.rb', line 16

def thumbnail_info
  candidate = nil
  max_dim = 251
  resources.each do |pid|
    resource = Resource.find(pid)
    if max_dim > resouce.long
      candidate = resource
      max_dim = resource.long
    end
  end
  if candidate.nil?
    return {:url=>image_url("cul_hydra/crystal/file_broken.png"),:mime=>'image/png'}
  else
    return {:url=>"#{ActiveFedora.fedora_config[:url]}/objects/#{candidate.pid}/datastreams/CONTENT/content",:mime=>candidate.datastreams['CONENT'].mimeType}
  end
end