Skip to content

A platform for community discussion. Free, open, simple.

DEV: Enable vips image processing by default (#44870)

Alan Guo Xiang Tan80c2c3fe7d03
diff --git a/config/discourse_defaults.conf b/config/discourse_defaults.conf
index 80eeda459c3..d7efe879910 100644
--- a/config/discourse_defaults.conf
+++ b/config/discourse_defaults.conf
@@ -416,7 +416,8 @@ asset_url_salt =
yjit_enabled = false
# Use libvips for letter avatar generation and dominant color detection.
-enable_vips_image_processing = false
+# This global setting is experimental and will be removed soon.
+enable_vips_image_processing = true
# Enable mini_racer single-threaded mode, and boot contexts before forking
mini_racer_single_threaded = true
diff --git a/spec/lib/upload_creator_spec.rb b/spec/lib/upload_creator_spec.rb
index 252d630f8ce..42acfb64d73 100644
--- a/spec/lib/upload_creator_spec.rb
+++ b/spec/lib/upload_creator_spec.rb
@@ -401,7 +401,8 @@ RSpec.describe UploadCreator do
# ruby -rzlib -e 'ihdr = [1, 1, 8, 6, 0, 0, 0].pack("NNCCCCC"); chunk = [ihdr.bytesize].pack("N") + "IHDR" + ihdr + [Zlib.crc32("IHDR" + ihdr)].pack("N"); File.binwrite("spec/fixtures/images/broken.png", "\x89PNG\r\n\x1A\n".b + chunk + ("\0".b * 80_000))'
let(:broken_png_file) { file_from_fixtures("broken.png") }
- it "does not persist the upload" do
+ it "does not persist the upload when ImageMagick cannot decode it" do
+ global_setting :enable_vips_image_processing, false
SiteSetting.png_to_jpg_quality = 1
expect do
diff --git a/spec/models/upload_spec.rb b/spec/models/upload_spec.rb
index 6598231c899..78336f37d63 100644
--- a/spec/models/upload_spec.rb
+++ b/spec/models/upload_spec.rb
@@ -1014,7 +1014,9 @@ RSpec.describe Upload do
upload
end
- it "correctly identifies and stores an image's dominant color" do
+ it "correctly identifies and stores an image's dominant color with ImageMagick" do
+ global_setting :enable_vips_image_processing, false
+
expect(white_image.dominant_color).to eq(nil)
expect(white_image.dominant_color(calculate_if_missing: true)).to eq("FFFFFF")
expect(white_image.dominant_color).to eq("FFFFFF")
@@ -1119,6 +1121,7 @@ RSpec.describe Upload do
end
it "raises when ImageMagick returns an invalid dominant color" do
+ global_setting :enable_vips_image_processing, false
ImageMagick.stubs(:magick).returns("someinvalidoutput")
expect(invalid_image.dominant_color).to eq(nil)