new 'convert_pasted_images_quality' site setting

This commit is contained in:
Régis Hanol
2016-07-27 19:59:44 +02:00
parent be099bb637
commit 6dac9075dc
3 changed files with 6 additions and 1 deletions

View File

@ -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"