Skip to content

Commit

Permalink
Imogen gem update; Now making use of new imogen method for scaleFacto…
Browse files Browse the repository at this point in the history
…rs calculation
  • Loading branch information
elohanlon committed Jul 28, 2024
1 parent ebccbb4 commit 7161d71
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
12 changes: 9 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions app/models/concerns/derivativo/iiif/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
}
],
Expand Down

0 comments on commit 7161d71

Please sign in to comment.