hydra-head 3.1.0.rc1 → 3.1.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.textile +1 -0
- data/app/controllers/get_controller.rb +1 -11
- data/app/views/_flash_msg.html.erb +5 -0
- data/lib/hydra-head/version.rb +1 -1
- metadata +4 -8
- data/app/helpers/hydra/hydra_djatoka_helper_behavior.rb +0 -23
- data/app/helpers/hydra_djatoka_helper.rb +0 -4
- data/app/views/catalog/_flash_msg.html.erb +0 -17
- data/lib/djatoka.rb +0 -59
- data/test_support/spec/helpers/hydra_djatoka_helper_spec.rb +0 -34
data/HISTORY.textile
CHANGED
|
@@ -13,17 +13,7 @@ class GetController < ApplicationController
|
|
|
13
13
|
format.jp2 do
|
|
14
14
|
canonical_jp2 = downloadables( fedora_object, :canonical=>true, :mime_type=>"image/jp2" )
|
|
15
15
|
jp2_content_url = "#{canonical_jp2.url}/content"
|
|
16
|
-
|
|
17
|
-
if params["image_server"]["scale"]
|
|
18
|
-
send_data Djatoka.scale(jp2_content_url, params["image_server"]["scale"]), :type=>"image/jpeg"
|
|
19
|
-
elsif params["image_server"]["region"]
|
|
20
|
-
send_data Djatoka.region(jp2_content_url, params["image_server"]["region"]), :type=>"image/jpeg"
|
|
21
|
-
else
|
|
22
|
-
send_data Djatoka.get_image(jp2_content_url, params["image_server"]["region"]), :type=>"image/jpeg"
|
|
23
|
-
end
|
|
24
|
-
else
|
|
25
|
-
send_datastream canonical_jp2
|
|
26
|
-
end
|
|
16
|
+
send_datastream canonical_jp2
|
|
27
17
|
end
|
|
28
18
|
end
|
|
29
19
|
|
data/lib/hydra-head/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hydra-head
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 15424097
|
|
5
5
|
prerelease: 6
|
|
6
6
|
segments:
|
|
7
7
|
- 3
|
|
8
8
|
- 1
|
|
9
9
|
- 0
|
|
10
10
|
- rc
|
|
11
|
-
-
|
|
12
|
-
version: 3.1.0.
|
|
11
|
+
- 2
|
|
12
|
+
version: 3.1.0.rc2
|
|
13
13
|
platform: ruby
|
|
14
14
|
authors:
|
|
15
15
|
- Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield, Justin Coyne & many more. See https://github.com/projecthydra/hydra-head/contributors
|
|
@@ -736,7 +736,6 @@ files:
|
|
|
736
736
|
- app/helpers/hydra/downloads_helper_behavior.rb
|
|
737
737
|
- app/helpers/hydra/generic_content_objects_helper_behavior.rb
|
|
738
738
|
- app/helpers/hydra/hydra_assets_helper_behavior.rb
|
|
739
|
-
- app/helpers/hydra/hydra_djatoka_helper_behavior.rb
|
|
740
739
|
- app/helpers/hydra/hydra_fedora_metadata_helper_behavior.rb
|
|
741
740
|
- app/helpers/hydra/hydra_helper_behavior.rb
|
|
742
741
|
- app/helpers/hydra/hydra_uploader_helper_behavior.rb
|
|
@@ -745,7 +744,6 @@ files:
|
|
|
745
744
|
- app/helpers/hydra/personalization_helper_behavior.rb
|
|
746
745
|
- app/helpers/hydra/release_process_helper_behavior.rb
|
|
747
746
|
- app/helpers/hydra_assets_helper.rb
|
|
748
|
-
- app/helpers/hydra_djatoka_helper.rb
|
|
749
747
|
- app/helpers/hydra_fedora_metadata_helper.rb
|
|
750
748
|
- app/helpers/hydra_helper.rb
|
|
751
749
|
- app/helpers/hydra_uploader_helper.rb
|
|
@@ -765,6 +763,7 @@ files:
|
|
|
765
763
|
- app/models/uses_default_partials.rb
|
|
766
764
|
- app/models/video_asset.rb
|
|
767
765
|
- app/views/_add_assets_links.html.erb
|
|
766
|
+
- app/views/_flash_msg.html.erb
|
|
768
767
|
- app/views/_user_util_links.html.erb
|
|
769
768
|
- app/views/catalog/_citation.html.erb
|
|
770
769
|
- app/views/catalog/_constraints_element.html.erb
|
|
@@ -774,7 +773,6 @@ files:
|
|
|
774
773
|
- app/views/catalog/_edit_partials/_default_details.html.erb
|
|
775
774
|
- app/views/catalog/_email_form.html.erb
|
|
776
775
|
- app/views/catalog/_facets.html.erb
|
|
777
|
-
- app/views/catalog/_flash_msg.html.erb
|
|
778
776
|
- app/views/catalog/_home.html.erb
|
|
779
777
|
- app/views/catalog/_home_text.html.erb
|
|
780
778
|
- app/views/catalog/_index_partials/_default.html.erb
|
|
@@ -946,7 +944,6 @@ files:
|
|
|
946
944
|
- lib/blacklight/blacklight_helper_behavior.rb
|
|
947
945
|
- lib/blacklight/catalog_helper.rb
|
|
948
946
|
- lib/block_mapper.rb
|
|
949
|
-
- lib/djatoka.rb
|
|
950
947
|
- lib/ead_mapper.rb
|
|
951
948
|
- lib/field_maps.rb
|
|
952
949
|
- lib/generators/hydra/assets_generator.rb
|
|
@@ -1107,7 +1104,6 @@ files:
|
|
|
1107
1104
|
- test_support/spec/helpers/file_assets_helper_spec.rb
|
|
1108
1105
|
- test_support/spec/helpers/hydra-repository_controller_spec.rb
|
|
1109
1106
|
- test_support/spec/helpers/hydra_assets_helper_spec.rb
|
|
1110
|
-
- test_support/spec/helpers/hydra_djatoka_helper_spec.rb
|
|
1111
1107
|
- test_support/spec/helpers/hydra_fedora_metadata_helper_spec.rb
|
|
1112
1108
|
- test_support/spec/helpers/hydra_helper_spec.rb
|
|
1113
1109
|
- test_support/spec/helpers/hydra_model_methods_spec.rb
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module Hydra::HydraDjatokaHelperBehavior
|
|
2
|
-
|
|
3
|
-
def hydra_djatoka_url_for(document, opts={})
|
|
4
|
-
|
|
5
|
-
if document.kind_of?(SolrDocument)
|
|
6
|
-
pid = document.id
|
|
7
|
-
elsif document.kind_of?(Mash)
|
|
8
|
-
pid = document[:id]
|
|
9
|
-
elsif document.respond_to?(:pid)
|
|
10
|
-
pid = document.pid
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
if !pid.nil?
|
|
14
|
-
if opts[:scale]
|
|
15
|
-
result = url_for(:controller=>:get,:action=>"show",:id=>pid, :format=>"jp2", "image_server[scale]"=>opts[:scale])
|
|
16
|
-
else
|
|
17
|
-
result = url_for(:controller=>:get,:action=>"show",:id=>pid, :format=>"jp2", "image_server"=>true)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<% if flash_notice = flash[:notice] %>
|
|
2
|
-
<div class="notice">
|
|
3
|
-
<% flash_notice.each do |message| %>
|
|
4
|
-
<div class="message"><%= message %></div>
|
|
5
|
-
<% end %>
|
|
6
|
-
</div>
|
|
7
|
-
<% end %>
|
|
8
|
-
<% if flash_error = flash[:error] %>
|
|
9
|
-
<div class="error">
|
|
10
|
-
<h4>Errors</h4>
|
|
11
|
-
<ul>
|
|
12
|
-
<% flash_error.each do |message| %>
|
|
13
|
-
<li class="message"><%= message %></li>
|
|
14
|
-
<% end %>
|
|
15
|
-
</ul>
|
|
16
|
-
</div>
|
|
17
|
-
<% end %>
|
data/lib/djatoka.rb
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
require "httparty"
|
|
2
|
-
class Djatoka
|
|
3
|
-
include HTTParty
|
|
4
|
-
# base_uri 'http://salt-dev.stanford.edu:8080/adore-djatoka/resolver'
|
|
5
|
-
base_uri "http://localhost:8080/adore-djatoka/resolver"
|
|
6
|
-
default_params :url_ver => 'Z39.88-2004', :svc_val_fmt=> "info:ofi/fmt:kev:mtx:jpeg2000"
|
|
7
|
-
|
|
8
|
-
# Uses Djatoka to scale the image from @source_url according to @scale_value
|
|
9
|
-
# Accepts optional hash that will be passed through to djatoka as-is
|
|
10
|
-
# scale_value is passed through to djatoka as svc.scale.
|
|
11
|
-
# From the Djatoka docs:
|
|
12
|
-
# svc.scale - Request specific output size by scaling extracted resource.
|
|
13
|
-
# Option 1) Define a long-side dimension (e.g., svc.scale=96)
|
|
14
|
-
# * Nearest resolution level, rounded up, is used for level parameter
|
|
15
|
-
# * Uses the aspect ratio to calculate second value
|
|
16
|
-
# Option 2) Define absolute w,h values (e.g. 1024,768)
|
|
17
|
-
# * Images is scaled to the dimensions you specify.
|
|
18
|
-
# * Value must be less than 2X current resolution
|
|
19
|
-
# Option 3) Define a single dimension (e.g. 1024,0) with or without Level Parameter
|
|
20
|
-
# * Uses the aspect ratio to calculate second value
|
|
21
|
-
# Option 4) Use a single decimal scaling factor (e.g. 0.854)
|
|
22
|
-
# * Current resolution = 1.0
|
|
23
|
-
# * 50% Resolution = 0.5
|
|
24
|
-
# * 150% Resolution = 1.5
|
|
25
|
-
# * Value must be greater than 0 and less than 2
|
|
26
|
-
def self.scale(source_url, scale_value, options={})
|
|
27
|
-
options.merge!("svc.scale"=>scale_value)
|
|
28
|
-
get_image(source_url, options)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Uses Djatoka to retrieve a redion of the image from @source_url according to @scale_value
|
|
32
|
-
# Accepts optional hash that will be passed through to djatoka as-is
|
|
33
|
-
# scale_value is passed through to djatoka as svc.scale.
|
|
34
|
-
# From the Djatoka docs:
|
|
35
|
-
# svc.region - Y,X,H,W.
|
|
36
|
-
# * Y is the down inset value (positive) from 0 on the y axis at the max image resolution.
|
|
37
|
-
# * X is the right inset value (positive) from 0 on the x axis at the max image resolution.
|
|
38
|
-
# * H is the height of the image provided as response.
|
|
39
|
-
# * W is the width of the image provided as response.
|
|
40
|
-
# * 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
|
-
def self.region(source_url, region_value, options={})
|
|
42
|
-
options.merge!("svc.region"=>region_value)
|
|
43
|
-
get_image(source_url, options)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def self.get_image(source_url, options={})
|
|
47
|
-
options.merge!({:svc_id => "info:lanl-repo/svc/getRegion", :rft_id=>source_url, "svc.format"=>"image/jpeg"})
|
|
48
|
-
puts "get_region options: #{options.inspect}"
|
|
49
|
-
get("", :query => options)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# url_ver=Z39.88-2004
|
|
55
|
-
# &rft_id=http://memory.loc.gov/gmd/gmd433/g4330/g4330/np000066.jp2
|
|
56
|
-
# &svc_id=info:lanl-repo/svc/getRegion
|
|
57
|
-
# &svc_val_fmt=info:ofi/fmt:kev:mtx:jpeg2000
|
|
58
|
-
# &svc.format=image/jpeg
|
|
59
|
-
# &svc.scale=600
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
2
|
-
include HydraDjatokaHelper
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
describe HydraDjatokaHelper do
|
|
6
|
-
|
|
7
|
-
describe "hydra_djatoka_url_for" do
|
|
8
|
-
it "should return the url for retrieving the given document's canonical jp2 url" do
|
|
9
|
-
mock_doc = mock("document")
|
|
10
|
-
mock_doc.expects(:kind_of?).with(SolrDocument).returns(true)
|
|
11
|
-
mock_doc.expects(:id).returns("myPid")
|
|
12
|
-
|
|
13
|
-
hydra_djatoka_url_for(mock_doc).should == "/get/myPid.jp2?image_server=true"
|
|
14
|
-
end
|
|
15
|
-
it "should work with a mash as the document" do
|
|
16
|
-
mock_doc = mock("document")
|
|
17
|
-
mock_doc.expects(:kind_of?).with(SolrDocument).returns(false)
|
|
18
|
-
mock_doc.expects(:kind_of?).with(Mash).returns(true)
|
|
19
|
-
mock_doc.expects(:[]).with(:id).returns("myPid")
|
|
20
|
-
|
|
21
|
-
hydra_djatoka_url_for(mock_doc).should == "/get/myPid.jp2?image_server=true"
|
|
22
|
-
end
|
|
23
|
-
it "should accept scale arguments" do
|
|
24
|
-
mock_doc = mock("document")
|
|
25
|
-
mock_doc.expects(:kind_of?).with(SolrDocument).returns(true)
|
|
26
|
-
mock_doc.expects(:id).returns("myPid")
|
|
27
|
-
# rails 3.1.x
|
|
28
|
-
# hydra_djatoka_url_for(mock_doc, :scale=>"90").should == "/get/myPid.jp2?image_server%5Bscale%5D=90"
|
|
29
|
-
# rails 3.0.x
|
|
30
|
-
hydra_djatoka_url_for(mock_doc, :scale=>"90").should == "/get/myPid.jp2?image_server[scale]=90"
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|