Module: Image::DwcMediaExtensions

Extended by:
ActiveSupport::Concern
Includes:
Shared::Dwc::MediaAttributionSql, Shared::Dwc::MediaExtensions
Included in:
Image
Defined in:
app/models/image/dwc_media_extensions.rb

Constant Summary collapse

DWC_MEDIA_IMAGE_EXTENSION_MAP =

Only implementations specific to Image. See Shared::Dwc::MediaExtensions#DWC_MEDIA_SHARED_EXTENSION_MAP as well.

{
  'dc:type': :dwc_media_dc_type,
  #'dcmi:type': :dwc_media_dcmi_type,
  accessURI: :dwc_media_access_uri,
  'dc:format': :dwc_media_dc_format,
  # 'dcterms:format',
  PixelXDimension: :dwc_media_pixel_x_dimension,
  PixelYDimension: :dwc_media_pixel_y_dimension,
  furtherInformationURL: :dwc_media_further_information_url,
}.freeze

Instance Method Summary collapse

Instance Method Details

#darwin_core_media_extension_image_rowObject



20
21
22
23
24
25
26
27
# File 'app/models/image/dwc_media_extensions.rb', line 20

def darwin_core_media_extension_image_row
  h = {}
  (DWC_MEDIA_IMAGE_EXTENSION_MAP.merge(Shared::Dwc::MediaExtensions::DWC_MEDIA_SHARED_EXTENSION_MAP)).each do |k, v|
    h[k] = send(v)
  end

  h
end

#dwc_media_access_uriObject



41
42
43
44
45
# File 'app/models/image/dwc_media_extensions.rb', line 41

def dwc_media_access_uri
  # TODO: can we make Image::Helpers.short_image_url work in this background
  # context instead?
  Shared::Api.image_link(self, raise_on_no_token: true)
end

#dwc_media_dc_formatObject



37
38
39
# File 'app/models/image/dwc_media_extensions.rb', line 37

def dwc_media_dc_format
  image_file_content_type
end

#dwc_media_dc_typeObject



29
30
31
# File 'app/models/image/dwc_media_extensions.rb', line 29

def dwc_media_dc_type
  'Image'
end

#dwc_media_dcmi_typeObject



33
34
35
# File 'app/models/image/dwc_media_extensions.rb', line 33

def dwc_media_dcmi_type
  'http://purl.org/dc/dcmitype/StillImage'
end

#dwc_media_further_information_urlObject



55
56
57
# File 'app/models/image/dwc_media_extensions.rb', line 55

def dwc_media_further_information_url
  Shared::Api.(self, raise_on_no_token: true)
end

#dwc_media_pixel_x_dimensionObject



47
48
49
# File 'app/models/image/dwc_media_extensions.rb', line 47

def dwc_media_pixel_x_dimension
  width
end

#dwc_media_pixel_y_dimensionObject



51
52
53
# File 'app/models/image/dwc_media_extensions.rb', line 51

def dwc_media_pixel_y_dimension
  height
end