Tweak billboard image quality to 100 (#20314)

This commit is contained in:
Ben Halpern 2023-11-03 14:07:24 -04:00 committed by GitHub
parent 41ab84a25d
commit aedeaede84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -220,14 +220,14 @@ class Billboard < ApplicationRecord
extracted_process_markdown
else # raw
self.processed_html = Html::Parser.new(body_markdown)
.prefix_all_images(width: 880, quality: 95, synchronous_detail_detection: true).html
.prefix_all_images(width: 880, quality: 100, synchronous_detail_detection: true).html
end
end
def extracted_process_markdown
renderer = ContentRenderer.new(body_markdown || "", source: self)
self.processed_html = renderer.process(prefix_images_options: { width: prefix_width,
quality: 95,
quality: 100,
synchronous_detail_detection: true }).processed_html
self.processed_html = processed_html.delete("\n")
end

View file

@ -196,7 +196,7 @@ RSpec.describe Billboard do
options = { http_header: { "User-Agent" => "DEV(local) (http://forem.test)" }, timeout: 10 }
expect(FastImage).to have_received(:size).with(image_url, options)
# width is billboard.prefix_width
expect(Images::Optimizer).to have_received(:call).with(image_url, width: Billboard::POST_WIDTH, quality: 95)
expect(Images::Optimizer).to have_received(:call).with(image_url, width: Billboard::POST_WIDTH, quality: 100)
# Images::Optimizer.call(source, width: width)
end
@ -206,7 +206,7 @@ RSpec.describe Billboard do
allow(Images::Optimizer).to receive(:call).and_return(image_url)
image_md = "![Image description](#{image_url})<p style='margin-top:100px'>Hello <em>hey</em> Hey hey</p>"
create(:billboard, body_markdown: image_md, placement_area: "post_sidebar")
expect(Images::Optimizer).to have_received(:call).with(image_url, width: Billboard::SIDEBAR_WIDTH, quality: 95)
expect(Images::Optimizer).to have_received(:call).with(image_url, width: Billboard::SIDEBAR_WIDTH, quality: 100)
end
it "uses post width for feed location" do
@ -215,7 +215,7 @@ RSpec.describe Billboard do
allow(Images::Optimizer).to receive(:call).and_return(image_url)
image_md = "![Image description](#{image_url})<p style='margin-top:100px'>Hello <em>hey</em> Hey hey</p>"
create(:billboard, body_markdown: image_md, placement_area: "feed_second")
expect(Images::Optimizer).to have_received(:call).with(image_url, width: Billboard::POST_WIDTH, quality: 95)
expect(Images::Optimizer).to have_received(:call).with(image_url, width: Billboard::POST_WIDTH, quality: 100)
end
it "keeps the same processed_html if markdown was not changed" do