riiif 0.0.8 → 0.0.9

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: 5b43fe6591b40519b5eaf7678c4b732bcae87e79
4
- data.tar.gz: 2c0d7e9b9e59f6e2886ab0830f3479bb09cabd29
3
+ metadata.gz: f5e8d0c868b034e0955aef6e76fe8e6b0944787a
4
+ data.tar.gz: 5e8e67c40d3804bd7d3852b10f1347493d110c5f
5
5
  SHA512:
6
- metadata.gz: aed34ce6c02744acc1cc74ea0d66ec2361aaca0578bfb9e6cc9742826088ac2edc7bef6f4755247f808d266b1eb659fcd08821797e548e0d4728a291d09f1c85
7
- data.tar.gz: 173080fd02eab35a999c52fdddf229ff416509c03471e0cdb666dfc5f26045fe6e2289cbbdcdbd22bc7210b481e3c1788b380930a98da2959a47aedc86a62df6
6
+ metadata.gz: b0f9f42f5a19abc877adba948c55b6e02ff5b03452d128df252823f65ac6c179e24e16885c9699550b4a86d09d5ddbed5463fc9b74ccccede4ea34d8adb49749
7
+ data.tar.gz: bb323cfe3324c38f2ebaffc0eec65044fd60c6fdd1cee9a0a3835f900ebec960f60402d770479ac716c8fdbfe254e556a3a2953d3cce6b4d3b94a342eee44ee1
data/README.md CHANGED
@@ -87,6 +87,9 @@ ImageMagick must be installed with jasper support
87
87
  ```bash
88
88
  brew install imagemagick --with-jasper # if using Homebrew
89
89
  ```
90
+ It appears that as of imagemagick 6.8.8 you have to use openjpeg2 instead of jasper:
91
+ http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=25357#p109912
92
+ This doesn't appear to be possible on homebrew until this ticket gets closed: https://github.com/Homebrew/homebrew/issues/28153
90
93
 
91
94
  Run the tests
92
95
  ```bash
@@ -11,7 +11,7 @@ module Riiif
11
11
  # example:
12
12
  # {:height=>390, :width=>600}
13
13
  self.info_service = lambda do |id, image|
14
- Rails.cache.fetch(Image.cache_key(id, { info: true }), compress: true, expires_in: 3.days) do
14
+ Rails.cache.fetch(cache_key(id, { info: true }), compress: true, expires_in: expires_in) do
15
15
  image.info
16
16
  end
17
17
  end
@@ -29,7 +29,7 @@ module Riiif
29
29
 
30
30
  def render(args)
31
31
  options = decode_options!(args)
32
- Rails.cache.fetch(Image.cache_key(id, options), compress: true, expires_in: 3.days) do
32
+ Rails.cache.fetch(Image.cache_key(id, options), compress: true, expires_in: Image.expires_in) do
33
33
  image.extract(options)
34
34
  end
35
35
  end
@@ -38,10 +38,17 @@ module Riiif
38
38
  info_service.call(id, image)
39
39
  end
40
40
 
41
- def self.cache_key(id, options)
42
- str = options.merge(id: id).delete_if {|_, v| v.nil?}.to_s
43
- # Use a MD5 digest to ensure the keys aren't too long.
44
- Digest::MD5.hexdigest(str)
41
+ class << self
42
+ def expires_in
43
+ Riiif::Engine.config.cache_duration_in_days.days
44
+ end
45
+
46
+
47
+ def cache_key(id, options)
48
+ str = options.merge(id: id).delete_if {|_, v| v.nil?}.to_s
49
+ # Use a MD5 digest to ensure the keys aren't too long.
50
+ Digest::MD5.hexdigest(str)
51
+ end
45
52
  end
46
53
 
47
54
  private
@@ -1,5 +1,8 @@
1
1
  module Riiif
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Riiif
4
+
5
+ # How long to cache the tiles for.
6
+ config.cache_duration_in_days = 3
4
7
  end
5
8
  end
@@ -1,3 +1,3 @@
1
1
  module Riiif
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler