Bump rszr from 0.4.0 to 0.5.2
Bumps [rszr](https://github.com/mtgrosser/rszr) from 0.4.0 to 0.5.2. - [Release notes](https://github.com/mtgrosser/rszr/releases) - [Changelog](https://github.com/mtgrosser/rszr/blob/master/CHANGELOG.md) - [Commits](https://github.com/mtgrosser/rszr/compare/v0.4.0...v0.5.2)
This commit is contained in:
parent
1e54645223
commit
7e113870a7
3 changed files with 13 additions and 23 deletions
2
Gemfile
2
Gemfile
|
@ -123,7 +123,7 @@ gem 'rubyntlm', git: 'https://github.com/wimm/rubyntlm'
|
||||||
gem 'viewpoint'
|
gem 'viewpoint'
|
||||||
|
|
||||||
# image processing
|
# image processing
|
||||||
gem 'rszr', '0.4.0'
|
gem 'rszr', '0.5.2'
|
||||||
|
|
||||||
# Gems used only for develop/test and not required
|
# Gems used only for develop/test and not required
|
||||||
# in production environments by default.
|
# in production environments by default.
|
||||||
|
|
|
@ -425,7 +425,7 @@ GEM
|
||||||
rspec-mocks (~> 3.8.0)
|
rspec-mocks (~> 3.8.0)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.8.0)
|
||||||
rspec-support (3.8.0)
|
rspec-support (3.8.0)
|
||||||
rszr (0.4.0)
|
rszr (0.5.2)
|
||||||
rubocop (0.67.2)
|
rubocop (0.67.2)
|
||||||
jaro_winkler (~> 1.5.1)
|
jaro_winkler (~> 1.5.1)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
|
@ -609,7 +609,7 @@ DEPENDENCIES
|
||||||
rb-fsevent
|
rb-fsevent
|
||||||
rchardet (>= 1.8.0)
|
rchardet (>= 1.8.0)
|
||||||
rspec-rails
|
rspec-rails
|
||||||
rszr (= 0.4.0)
|
rszr (= 0.5.2)
|
||||||
rubocop
|
rubocop
|
||||||
rubocop-performance
|
rubocop-performance
|
||||||
rubocop-rspec
|
rubocop-rspec
|
||||||
|
|
|
@ -281,10 +281,6 @@ returns
|
||||||
file.provider
|
file.provider
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.semaphore
|
|
||||||
@semaphore ||= Mutex.new
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def image_resize(content, width)
|
def image_resize(content, width)
|
||||||
|
@ -299,9 +295,6 @@ returns
|
||||||
temp_file.binmode
|
temp_file.binmode
|
||||||
temp_file.write(content)
|
temp_file.write(content)
|
||||||
temp_file.close
|
temp_file.close
|
||||||
|
|
||||||
temp_file_resize = nil
|
|
||||||
self.class.semaphore.synchronize do
|
|
||||||
image = Rszr::Image.load(temp_file.path)
|
image = Rszr::Image.load(temp_file.path)
|
||||||
|
|
||||||
# do not resize image if image is smaller or already same size
|
# do not resize image if image is smaller or already same size
|
||||||
|
@ -315,9 +308,6 @@ returns
|
||||||
image.resize!(width, :auto)
|
image.resize!(width, :auto)
|
||||||
temp_file_resize = ::Tempfile.new.path
|
temp_file_resize = ::Tempfile.new.path
|
||||||
image.save(temp_file_resize)
|
image.save(temp_file_resize)
|
||||||
image.send(:handle).finalize!
|
|
||||||
end
|
|
||||||
|
|
||||||
image_resized = ::File.binread(temp_file_resize)
|
image_resized = ::File.binread(temp_file_resize)
|
||||||
|
|
||||||
Cache.write(cache_key, image_resized, { expires_in: 6.months })
|
Cache.write(cache_key, image_resized, { expires_in: 6.months })
|
||||||
|
|
Loading…
Reference in a new issue