cul_scv_hydra 0.22.9.1 → 0.22.9.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dfef7d4cc06013efb54de0725d882d49b043d6b
|
4
|
+
data.tar.gz: 6fb3fcdb39e0ed72bd1c6002efa969bd7edaeb12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efdfeea63e0d34298a29015048ee81ea86945d97f3dd1585e61f68376ec90cee6ddc70ed7af4b82d79bbf44b8cf5adfb38a21906fb0d305e7f7a5a244a620d38
|
7
|
+
data.tar.gz: fc309b63eb069ccdae2169b4bf4cd86c4898a3de41958a8780d4737d07bf96fc05e4d44ff3fc783943bed28df89268d5f1fb992ef9892d98c587f75272a5dbeb
|
@@ -21,6 +21,14 @@ module Cul::Hydra::Models::ImageResource
|
|
21
21
|
|
22
22
|
DJATOKA_BASE_URL = "http://iris.cul.columbia.edu:8888/resolve"
|
23
23
|
|
24
|
+
EXIF_ORIENTATION_TO_DEGREES = {
|
25
|
+
'top-left' => 0,
|
26
|
+
'left-bottom' => 90,
|
27
|
+
'bottom-right' => 180,
|
28
|
+
'right-top' => 270
|
29
|
+
}
|
30
|
+
DEGREES_TO_EXIF_ORIENTATIONS = EXIF_ORIENTATION_TO_DEGREES.invert
|
31
|
+
|
24
32
|
def long
|
25
33
|
@long_side ||= max(width(), length())
|
26
34
|
end
|
@@ -75,4 +83,24 @@ module Cul::Hydra::Models::ImageResource
|
|
75
83
|
return {:asset=>"cul_scv_hydra/crystal/file.png",:mime=>'image/png'}
|
76
84
|
end
|
77
85
|
end
|
86
|
+
|
87
|
+
# The number of rotational degrees required to display this image as upright
|
88
|
+
def required_rotation_for_upright_display
|
89
|
+
required_rotation_orientation_in_degrees = (360 - self.orientation) % 360
|
90
|
+
return required_rotation_orientation_in_degrees
|
91
|
+
end
|
92
|
+
|
93
|
+
# Allowed degrees arg values: 0, 90, 180, 270
|
94
|
+
def orientation=(degrees)
|
95
|
+
degrees = degrees % 360
|
96
|
+
raise "Invalid value for degrees. Must be a right angle (0, 90, 180, etc.)" unless (degrees % 90 == 0)
|
97
|
+
self.clear_relationship(:orientation)
|
98
|
+
self.add_relationship(:orientation, DEGREES_TO_EXIF_ORIENTATIONS[degrees], true)
|
99
|
+
return degrees # Hide RDF backing structure and make this look like a simple setter method
|
100
|
+
end
|
101
|
+
|
102
|
+
def orientation
|
103
|
+
self.relationships(:orientation).present? ? EXIF_ORIENTATION_TO_DEGREES[self.relationships(:orientation).first.to_s] : 0
|
104
|
+
end
|
105
|
+
|
78
106
|
end
|
@@ -142,24 +142,28 @@ class GenericResource < ::ActiveFedora::Base
|
|
142
142
|
(zr = rels_int.relationships(datastreams['content'], :foaf_zooming) and not zr.first.blank?)
|
143
143
|
end
|
144
144
|
|
145
|
-
def
|
145
|
+
def with_ds_resource(ds_id, fedora_content_filesystem_mounted=false, &block)
|
146
146
|
|
147
|
-
|
147
|
+
ds = self.datastreams[ds_id]
|
148
148
|
|
149
|
-
|
150
|
-
|
151
|
-
|
149
|
+
puts 'dsLocation.start_with?(self.pid) : ' + ds.dsLocation.start_with?(self.pid).to_s
|
150
|
+
|
151
|
+
# If the dsLocation starts with the pid, that means that we're dealing with an internally-managed ds,
|
152
|
+
# so we can't reference the file directly even if we do have the fedora content filesystem mounted.
|
153
|
+
if ! ds.dsLocation.start_with?(self.pid) && fedora_content_filesystem_mounted
|
154
|
+
if ds.dsLocation =~ /^file:\//
|
155
|
+
dsLocation = ds.dsLocation.sub(/^file:\/+/,'/')
|
152
156
|
path = URI.unescape(dsLocation)
|
153
157
|
else
|
154
|
-
path =
|
158
|
+
path = ds.dsLocation
|
155
159
|
end
|
156
160
|
|
157
161
|
yield(path)
|
158
162
|
else
|
159
|
-
internal_uri = "info:fedora/#{self.pid}
|
163
|
+
internal_uri = "info:fedora/#{self.pid}/#{ds_id}"
|
160
164
|
# No local fedora mount, need to download content over http[s]
|
161
165
|
|
162
|
-
file_basename = File.basename(
|
166
|
+
file_basename = File.basename(ds.dsLocation.gsub(/^file:/,''))
|
163
167
|
file_extension = File.extname(file_basename)
|
164
168
|
|
165
169
|
# In some cases, we actually do want to know the original extension of the file, so we'll preserve it in the temp file filename
|
data/lib/cul_hydra/version.rb
CHANGED
data/lib/cul_hydra/version.rb~
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cul_scv_hydra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.22.9.
|
4
|
+
version: 0.22.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Armintor
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: blacklight
|
@@ -527,4 +527,3 @@ signing_key:
|
|
527
527
|
specification_version: 4
|
528
528
|
summary: ActiveFedora, OM, and Solrizer implementations for CUL repository apps
|
529
529
|
test_files: []
|
530
|
-
has_rdoc:
|