README.md in riiif-0.0.9 vs README.md in riiif-0.0.10
- old
+ new
@@ -3,10 +3,22 @@
A Ruby IIIF image server as a rails engine
## Installation
+RIIIF depends on Imagemagick so you must install that first. On a mac using Homebrew you can follow these instructions:
+
+ImageMagick (6.8.8) may be installed with a few options:
+* `--with-ghostscript` Compile with Ghostscript for Postscript/PDF support
+* `--with-tiff` Compile with libtiff support for TIFF files
+* `--with-jp2` Compile with openjpeg2 support for jpeg2000
+
+```bash
+brew install imagemagick --with-ghostscript --with-tiff --with-jp2
+```
+
+## Install the gem
Add this line to your application's Gemfile:
gem 'riiif'
And then execute:
@@ -61,10 +73,18 @@
* http://www.example.org/image-service/abcd1234/full/,100/0/native.jpg
* http://www.example.org/image-service/abcd1234/full/pct:50/0/native.jpg
* http://www.example.org/image-service/abcd1234/full/150,75/0/native.jpg
* http://www.example.org/image-service/abcd1234/full/!150,75/0/native.jpg
+### Route helpers
+
+It is prefereable that you use the provided route helpers to build these URIs. Here's an example:
+
+```ruby
+ image_tag(Riiif::Engine.routes.url_helpers.image_path(file_id, size: ',600'))
+```
+
### Using a default image
If there is a request for an id that doesn't exist, a 404 will be returned. You can optionally return an image with this 404 by setting this in your initializer:
```ruby
@@ -75,22 +95,58 @@
```ruby
Riiif::Image.new('no_image', Riiif::File.new(Riiif.not_found_image))
```
+## Integration with Hydra/Fedora
+
+Create an initializer like this in `config/initializers/riiif_initializer.rb`
+
+```ruby
+# Tell RIIIF to get files via HTTP (not from the local disk)
+Riiif::Image.file_resolver = Riiif::HTTPFileResolver
+
+# This tells RIIIF how to resolve the identifier to a URI in Fedora
+DATASTREAM = 'imageContent'
+Riiif::HTTPFileResolver.id_to_uri = lambda do |id|
+ connection = ActiveFedora::Base.connection_for_pid(id)
+ host = connection.config[:url]
+ path = connection.api.datastream_content_url(id, DATASTREAM, {})
+ host + '/' + path
+end
+
+# In order to return the info.json endpoint, we have to have the full height and width of
+# each image. If you are using hydra-file_characterization, you have the height & width
+# cached in Solr. The following block directs the info_service to return those values:
+HEIGHT_SOLR_FIELD = 'height_isi'
+WIDTH_SOLR_FIELD = 'width_isi'
+Riiif::Image.info_service = lambda do |id, file|
+ resp = get_solr_response_for_doc_id id
+ doc = resp.first['response']['docs'].first
+ { height: doc[HEIGHT_SOLR_FIELD], width: doc[WIDTH_SOLR_FIELD] }
+end
+
+include Blacklight::SolrHelper
+def blacklight_config
+ CatalogController.blacklight_config
+end
+
+### ActiveSupport::Benchmarkable (used in Blacklight::SolrHelper) depends on a logger method
+
+def logger
+ Rails.logger
+end
+
+
+Riiif::Engine.config.cache_duration_in_days = 30
+```
+
+
## Running the tests
First, build the engine
```bash
rake engine_cart:generate
```
-
-ImageMagick must be installed with jasper support
-```bash
-brew install imagemagick --with-jasper # if using Homebrew
-```
-It appears that as of imagemagick 6.8.8 you have to use openjpeg2 instead of jasper:
-http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=25357#p109912
-This doesn't appear to be possible on homebrew until this ticket gets closed: https://github.com/Homebrew/homebrew/issues/28153
Run the tests
```bash
rake spec
```