diff --git a/Gemfile b/Gemfile index 52b050b..33fbb67 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,8 @@ gem 'active_fedora_relsint', :git => 'https://github.com/cul/active_fedora_relsi gem 'blacklight', '~> 7.22' gem 'view_component', '~> 2.51.0' # Use imogen for generating images -gem 'imogen', '0.3.0' +# gem 'imogen', '0.3.2' +gem 'imogen', git: 'https://github.com/cul/imogen.git', branch: 'iiif_tile_generation_fixes' gem 'ruby-vips', '~> 2.0.16' #gem 'imogen', :path => '../imogen' diff --git a/Gemfile.lock b/Gemfile.lock index 6a5b420..ec59209 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -27,6 +27,14 @@ GIT sparql thread +GIT + remote: https://github.com/cul/imogen.git + revision: 93fe37dcf7ff7f9f0b2d843bcc71f80a7b1b9d79 + branch: iiif_tile_generation_fixes + specs: + imogen (0.4.0.pre.rc.1) + ruby-vips + GIT remote: https://github.com/samvera-deprecated/jettywrapper.git revision: 6b03c21726a83dcecf09d9b20683bfcd63f106d1 @@ -208,8 +216,6 @@ GEM httpclient (2.8.3) i18n (1.10.0) concurrent-ruby (~> 1.0) - imogen (0.3.0) - ruby-vips iso-639 (0.3.5) jbuilder (2.11.5) actionview (>= 5.0.0) @@ -498,7 +504,7 @@ DEPENDENCIES capistrano-rails (~> 1.1) capistrano-rvm (~> 0.1) cul_hydra! - imogen (= 0.3.0) + imogen! jbuilder (~> 2.0) jettywrapper (>= 2.0.5)! jquery-rails diff --git a/app/models/concerns/derivativo/iiif/info.rb b/app/models/concerns/derivativo/iiif/info.rb index 47539e4..3e5e768 100644 --- a/app/models/concerns/derivativo/iiif/info.rb +++ b/app/models/concerns/derivativo/iiif/info.rb @@ -5,9 +5,7 @@ def info(id_url, version) raise 'Only IIIF version 2 is supported at the moment' unless version.to_s == '2' original_width, original_height = get_cachable_property(Derivativo::Iiif::CacheKeys::ORIGINAL_IMAGE_DIMENSIONS_KEY) - largest_scale_factor = Imogen::Zoomable.max_levels_for(original_width, original_height, IiifResource::TILE_SIZE) - largest_scale_factor -= Math.log2(IiifResource::TILE_SIZE/2) # remove scales smaller than tile size - scale_factors = (0..((largest_scale_factor).to_i)).map { |exp| 2.pow(exp) } + scale_factors = Imogen::Iiif::Tiles.scale_factors_for(original_width, original_height, IiifResource::TILE_SIZE) is_restricted_size_image = get_cachable_property(Derivativo::Iiif::CacheKeys::IS_RESTRICTED_SIZE_IMAGE_KEY) @@ -21,7 +19,7 @@ def info(id_url, version) "tiles" => [ { "width" => IiifResource::TILE_SIZE, - "height" => IiifResource::TILE_SIZE, + #"height" => IiifResource::TILE_SIZE, "scaleFactors" => scale_factors } ],