A platform for community discussion. Free, open, simple.
DEV: Allow for taller images in posts and oneboxes (#15395)
Blake Ericksonb705971d420c
diff --git a/config/site_settings.yml b/config/site_settings.ymlindex fcd3cde83a3..4ef25f85d28 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -1431,7 +1431,7 @@ files:strip_image_metadata: truemin_ratio_to_crop:type: float- default: 0.45 # 90% of 18:9+ default: 0.22min: 0max: 1simultaneous_uploads:diff --git a/spec/components/cooked_post_processor_spec.rb b/spec/components/cooked_post_processor_spec.rbindex debf3b8997c..77f9cb4b3a4 100644--- a/spec/components/cooked_post_processor_spec.rb+++ b/spec/components/cooked_post_processor_spec.rb@@ -535,8 +535,32 @@ describe CookedPostProcessor doendend- context "with tall images" do- fab!(:upload) { Fabricate(:image_upload, width: 860, height: 2000) }+ context "with tall images > default aspect ratio" do+ fab!(:upload) { Fabricate(:image_upload, width: 500, height: 2200) }++ fab!(:post) do+ Fabricate(:post, raw: <<~HTML)+ <img src="#{upload.url}">+ HTML+ end++ let(:cpp) { CookedPostProcessor.new(post, disable_loading_image: true) }++ before do+ SiteSetting.create_thumbnails = true+ end++ it "resizes the image instead of crop" do+ cpp.post_process++ expect(cpp.html).to match(/width="113" height="500">/)+ expect(cpp).to be_dirty+ end++ end++ context "with taller images < default aspect ratio" do+ fab!(:upload) { Fabricate(:image_upload, width: 500, height: 2300) }fab!(:post) doFabricate(:post, raw: <<~HTML)@@ -553,7 +577,7 @@ describe CookedPostProcessor doit "crops the image" docpp.post_process- expect(cpp.html).to match(/width="690" height="500">/)+ expect(cpp.html).to match(/width="500" height="500">/)expect(cpp).to be_dirtyend