Class: Djatoka

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
vendor/plugins/hydra_repository/lib/djatoka.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) get_image(source_url, options = {})



46
47
48
49
50
# File 'vendor/plugins/hydra_repository/lib/djatoka.rb', line 46

def self.get_image(source_url, options={})
  options.merge!({:svc_id => "info:lanl-repo/svc/getRegion", :rft_id=>source_url, "svc.format"=>"image/jpeg"})
  puts "get_region options: #{options.inspect}"
  get("", :query => options)
end

+ (Object) region(source_url, region_value, options = {})

Uses Djatoka to retrieve a redion of the image from @source_url according to @scale_value Accepts optional hash that will be passed through to djatoka as-is scale_value is passed through to djatoka as svc.scale. From the Djatoka docs: svc.region - Y,X,H,W.

  • Y is the down inset value (positive) from 0 on the y axis at the max image resolution.

  • X is the right inset value (positive) from 0 on the x axis at the max image resolution.

  • H is the height of the image provided as response.

  • W is the width of the image provided as response.

  • All values may either be absolute pixel values (e.g. 100,100,256,256), float values (e.g. 0.1,0.1,0.1,0.1), or a combination (e.g. 0.1,0.1,256,256).



41
42
43
44
# File 'vendor/plugins/hydra_repository/lib/djatoka.rb', line 41

def self.region(source_url, region_value, options={})
  options.merge!("svc.region"=>region_value)
  get_image(source_url, options)
end

+ (Object) scale(source_url, scale_value, options = {})

Uses Djatoka to scale the image from @source_url according to @scale_value Accepts optional hash that will be passed through to djatoka as-is scale_value is passed through to djatoka as svc.scale. From the Djatoka docs: svc.scale - Request specific output size by scaling extracted resource. Option 1) Define a long-side dimension (e.g., svc.scale=96)

  • Nearest resolution level, rounded up, is used for level parameter

  • Uses the aspect ratio to calculate second value

Option 2) Define absolute w,h values (e.g. 1024,768)

  • Images is scaled to the dimensions you specify.

  • Value must be less than 2X current resolution

Option 3) Define a single dimension (e.g. 1024,0) with or without Level Parameter

  • Uses the aspect ratio to calculate second value

Option 4) Use a single decimal scaling factor (e.g. 0.854)

  • Current resolution = 1.0

  • 50% Resolution = 0.5

  • 150% Resolution = 1.5

  • Value must be greater than 0 and less than 2



26
27
28
29
# File 'vendor/plugins/hydra_repository/lib/djatoka.rb', line 26

def self.scale(source_url, scale_value, options={})
  options.merge!("svc.scale"=>scale_value)
  get_image(source_url, options)
end