Skip to content

Commit

Permalink
Disable libvips image caching
Browse files Browse the repository at this point in the history
We need to do so because we're writing back the converted image to original path, this is incompatible with caching.
https://github.com/carrierwaveuploader/carrierwave/pull/2500/files#diff-4869e78ddf0b4b710715e110a80ba9e64ace96ca93ca43300e57f927dcfd52a4R304
  • Loading branch information
mshibuya committed Feb 22, 2021
1 parent f23e9aa commit e842197
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/carrierwave/processing/vips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ module Vips

included do
require "image_processing/vips"
# We need to disable caching since we're editing images in place.
::Vips.cache_set_max(0)
end

module ClassMethods
Expand Down
2 changes: 1 addition & 1 deletion spec/processing/vips_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
end

it "doesn't pad with transparent" do
instance.resize_and_pad(200, 200)
instance.resize_and_pad(200, 200, [255, 255, 255])
instance.convert('png')

color_of_pixel(instance.current_path, 0, 0).tap do |color|
Expand Down

0 comments on commit e842197

Please sign in to comment.