diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index 70119a210..95413db5a 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -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" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index d409149c8..a3ffb33f8 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1070,6 +1070,7 @@ en: allow_all_attachments_for_group_messages: "Allow all email attachments for group messages." convert_pasted_images_to_hq_jpg: "Convert pasted images to high-quality JPG files." + convert_pasted_images_quality: "Quality of the converted JPG file (1 is lowest quality, 100 is best quality)." enable_flash_video_onebox: "Enable embedding of swf and flv (Adobe Flash) links in oneboxes. WARNING: may introduce security risks." diff --git a/config/site_settings.yml b/config/site_settings.yml index 35bf337a9..db4da7608 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -718,6 +718,10 @@ files: default_opengraph_image_url: '' allow_all_attachments_for_group_messages: false convert_pasted_images_to_hq_jpg: true + convert_pasted_images_quality: + default: 95 + min: 1 + max: 100 trust: default_trust_level: