mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 19:55:43 +00:00
FEATURE: new 'convert_pasted_images_to_hq_jpg' site setting
This commit is contained in:
parent
ece4fa82c9
commit
749b981759
@ -70,6 +70,15 @@ class UploadsController < ApplicationController
|
|||||||
|
|
||||||
return { errors: I18n.t("upload.file_missing") } if tempfile.nil?
|
return { errors: I18n.t("upload.file_missing") } if tempfile.nil?
|
||||||
|
|
||||||
|
# convert pasted images to HQ jpegs
|
||||||
|
if filename == "blob.png" && SiteSetting.convert_pasted_images_to_hq_jpg
|
||||||
|
filename = "blob.jpg"
|
||||||
|
jpeg_path = "#{File.dirname(tempfile.path)}/#{filename}"
|
||||||
|
content_type = "image/jpeg"
|
||||||
|
`convert #{tempfile.path} -quality 95 #{jpeg_path}`
|
||||||
|
tempfile = File.open(jpeg_path)
|
||||||
|
end
|
||||||
|
|
||||||
# allow users to upload large images that will be automatically reduced to allowed size
|
# allow users to upload large images that will be automatically reduced to allowed size
|
||||||
max_image_size_kb = SiteSetting.max_image_size_kb.kilobytes
|
max_image_size_kb = SiteSetting.max_image_size_kb.kilobytes
|
||||||
if max_image_size_kb > 0 && FileHelper.is_image?(filename)
|
if max_image_size_kb > 0 && FileHelper.is_image?(filename)
|
||||||
|
@ -1069,6 +1069,8 @@ en:
|
|||||||
|
|
||||||
allow_all_attachments_for_group_messages: "Allow all email attachments for group messages."
|
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."
|
||||||
|
|
||||||
enable_flash_video_onebox: "Enable embedding of swf and flv (Adobe Flash) links in oneboxes. WARNING: may introduce security risks."
|
enable_flash_video_onebox: "Enable embedding of swf and flv (Adobe Flash) links in oneboxes. WARNING: may introduce security risks."
|
||||||
|
|
||||||
default_invitee_trust_level: "Default trust level (0-4) for invited users."
|
default_invitee_trust_level: "Default trust level (0-4) for invited users."
|
||||||
|
@ -717,6 +717,7 @@ files:
|
|||||||
shadowed_by_global: true
|
shadowed_by_global: true
|
||||||
default_opengraph_image_url: ''
|
default_opengraph_image_url: ''
|
||||||
allow_all_attachments_for_group_messages: false
|
allow_all_attachments_for_group_messages: false
|
||||||
|
convert_pasted_images_to_hq_jpg: true
|
||||||
|
|
||||||
trust:
|
trust:
|
||||||
default_trust_level:
|
default_trust_level:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user