mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
new 'convert_pasted_images_quality' site setting
This commit is contained in:
@ -73,7 +73,7 @@ class UploadsController < ApplicationController
|
||||
# convert pasted images to HQ jpegs
|
||||
if filename == "blob.png" && SiteSetting.convert_pasted_images_to_hq_jpg
|
||||
jpeg_path = "#{File.dirname(tempfile.path)}/blob.jpg"
|
||||
`convert #{tempfile.path} -quality 95 #{jpeg_path}`
|
||||
`convert #{tempfile.path} -quality #{SiteSetting.convert_pasted_images_quality} #{jpeg_path}`
|
||||
# only change the format of the image when JPG is at least 5% smaller
|
||||
if File.size(jpeg_path) < File.size(tempfile.path) * 0.95
|
||||
filename = "blob.jpg"
|
||||
|
Reference in New Issue
Block a user