riiif 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -18
- data/app/controllers/riiif/images_controller.rb +1 -1
- data/app/models/riiif/image.rb +1 -1
- data/lib/riiif/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0af476f4ae806dfd50b80d55822b1b4e737bca3
|
4
|
+
data.tar.gz: a19cc06b6257e2e8bfc20e10ebca47d842b71521
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcfa15704d359abae49010c15e118f24a4107c56d0f5839a5cb8494216dabf7e6b8207338988b13f54b4ed39d37fa8857e6426a5974d376011d5bcdc1a1036f9
|
7
|
+
data.tar.gz: 521ca263dd137a5a96e9d816f84576f04b3e175e0fc7c9382fdc33a88be375ff39a23b288645054f3c64142c9921fbd4c188ad8f0d57bccbf97ab7003ac96a60
|
data/README.md
CHANGED
@@ -129,37 +129,32 @@ Create an initializer like this in `config/initializers/riiif_initializer.rb`
|
|
129
129
|
Riiif::Image.file_resolver = Riiif::HTTPFileResolver.new
|
130
130
|
|
131
131
|
# This tells RIIIF how to resolve the identifier to a URI in Fedora
|
132
|
-
DATASTREAM = 'imageContent'
|
133
132
|
Riiif::Image.file_resolver.id_to_uri = lambda do |id|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
host + '/' + path
|
133
|
+
ActiveFedora::Base.id_to_uri(CGI.unescape(id)).tap do |url|
|
134
|
+
logger.info "Riiif resolved #{id} to #{url}"
|
135
|
+
end
|
138
136
|
end
|
139
137
|
|
140
138
|
# In order to return the info.json endpoint, we have to have the full height and width of
|
141
139
|
# each image. If you are using hydra-file_characterization, you have the height & width
|
142
140
|
# cached in Solr. The following block directs the info_service to return those values:
|
143
|
-
HEIGHT_SOLR_FIELD = 'height_isi'
|
144
|
-
WIDTH_SOLR_FIELD = 'width_isi'
|
145
141
|
Riiif::Image.info_service = lambda do |id, file|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
142
|
+
# id will look like a path to a pcdm:file
|
143
|
+
# (e.g. rv042t299%2Ffiles%2F6d71677a-4f80-42f1-ae58-ed1063fd79c7)
|
144
|
+
# but we just want the id for the FileSet it's attached to.
|
145
|
+
|
146
|
+
# Capture everything before the first slash
|
147
|
+
fs_id = id.sub(/\A([^\/]*)\/.*/, '\1')
|
148
|
+
resp = ActiveFedora::SolrService.get("id:#{fs_id}")
|
149
|
+
doc = resp['response']['docs'].first
|
150
|
+
raise "Unable to find solr document with id:#{fs_id}" unless doc
|
151
|
+
{ height: doc['height_is'], width: doc['width_is'] }
|
154
152
|
end
|
155
153
|
|
156
|
-
### ActiveSupport::Benchmarkable (used in Blacklight::SolrHelper) depends on a logger method
|
157
|
-
|
158
154
|
def logger
|
159
155
|
Rails.logger
|
160
156
|
end
|
161
157
|
|
162
|
-
|
163
158
|
Riiif::Engine.config.cache_duration_in_days = 30
|
164
159
|
```
|
165
160
|
|
@@ -41,7 +41,7 @@ module Riiif
|
|
41
41
|
# this is a workaround for https://github.com/rails/rails/issues/25087
|
42
42
|
def redirect
|
43
43
|
# This was attempted with just info_path, but it gave a NoMethodError
|
44
|
-
redirect_to
|
44
|
+
redirect_to riiif.info_path(params[:id])
|
45
45
|
end
|
46
46
|
|
47
47
|
protected
|
data/app/models/riiif/image.rb
CHANGED
@@ -63,7 +63,7 @@ module Riiif
|
|
63
63
|
##
|
64
64
|
# @param [ActiveSupport::HashWithIndifferentAccess] options
|
65
65
|
def decode_options!(options)
|
66
|
-
raise ArgumentError,
|
66
|
+
raise ArgumentError, "You must provide a format. You provided #{options}" unless options[:format]
|
67
67
|
options[:crop] = decode_region(options.delete(:region))
|
68
68
|
options[:size] = decode_size(options.delete(:size))
|
69
69
|
options[:quality] = decode_quality(options[:quality])
|
data/lib/riiif/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riiif
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
192
|
rubyforge_project:
|
193
|
-
rubygems_version: 2.
|
193
|
+
rubygems_version: 2.6.10
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: A rails engine that support IIIF requests
|