forked from e621ng/e621ng
[Cleanup] Replace ruby-imagespec with Vips::Image
ImageSpec is also capable of providing sizes for flash, but that isn't exactly relevant anymore
This commit is contained in:
parent
4168692f2d
commit
b05a8a5a51
3
Gemfile
3
Gemfile
@ -39,9 +39,6 @@ gem 'elasticsearch-rails'
|
||||
gem 'mailgun-ruby'
|
||||
gem 'resolv'
|
||||
|
||||
# needed for looser jpeg header compat
|
||||
gem 'ruby-imagespec', :require => "image_spec", :git => "https://github.com/r888888888/ruby-imagespec.git", :branch => "exif-fixes"
|
||||
|
||||
group :production, :staging do
|
||||
gem 'unicorn', :platforms => :ruby
|
||||
end
|
||||
|
@ -1,10 +1,3 @@
|
||||
GIT
|
||||
remote: https://github.com/r888888888/ruby-imagespec.git
|
||||
revision: 2dab9811f4abb4fbaeea66feb42e388ba545b2d8
|
||||
branch: exif-fixes
|
||||
specs:
|
||||
ruby-imagespec (0.3.1)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/zwagoth/dtext_rb.git
|
||||
revision: efc37c7795c53425935245cde57cef2121b4f402
|
||||
@ -400,7 +393,6 @@ DEPENDENCIES
|
||||
resolv
|
||||
responders
|
||||
retriable
|
||||
ruby-imagespec!
|
||||
ruby-vips
|
||||
sanitize
|
||||
shoulda-context
|
||||
|
@ -69,8 +69,8 @@ module FileMethods
|
||||
[video.width, video.height]
|
||||
|
||||
elsif is_image?
|
||||
image_size = ImageSpec.new(file_path)
|
||||
[image_size.width, image_size.height]
|
||||
image = Vips::Image.new_from_file(file_path)
|
||||
[image.width, image.height]
|
||||
|
||||
else
|
||||
[0, 0]
|
||||
|
@ -105,10 +105,12 @@ class UploadServiceTest < ActiveSupport::TestCase
|
||||
preview, crop, sample = subject.generate_resizes(@file, @upload)
|
||||
assert_operator(File.size(preview.path), :>, 0)
|
||||
assert_operator(File.size(crop.path), :>, 0)
|
||||
assert_equal(150, ImageSpec.new(preview.path).width)
|
||||
assert_equal(150, ImageSpec.new(preview.path).height)
|
||||
assert_equal(150, ImageSpec.new(crop.path).width)
|
||||
assert_equal(150, ImageSpec.new(crop.path).height)
|
||||
preview_image = Vips::Image.new_from_file(preview.path)
|
||||
crop_image = Vips::Image.new_from_file(crop.path)
|
||||
assert_equal(150, preview_image.width)
|
||||
assert_equal(150, preview_image.height)
|
||||
assert_equal(150, crop_image.width)
|
||||
assert_equal(150, crop_image.height)
|
||||
preview.close
|
||||
preview.unlink
|
||||
crop.close
|
||||
|
Loading…
Reference in New Issue
Block a user