mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
DEV: replace imagemagick convert commands with magick (#27767)
This commit is contained in:
parent
28f5550886
commit
17aa831337
|
@ -5,7 +5,7 @@ class ProblemCheck::ImageMagick < ProblemCheck
|
||||||
|
|
||||||
def call
|
def call
|
||||||
return no_problem if !SiteSetting.create_thumbnails
|
return no_problem if !SiteSetting.create_thumbnails
|
||||||
return no_problem if Kernel.system("command -v convert >/dev/null;")
|
return no_problem if Kernel.system("command -v magick >/dev/null;")
|
||||||
|
|
||||||
problem
|
problem
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,7 +91,7 @@ class LetterAvatar
|
||||||
#{filename}
|
#{filename}
|
||||||
]
|
]
|
||||||
|
|
||||||
Discourse::Utils.execute_command("convert", *instructions)
|
Discourse::Utils.execute_command("magick", *instructions)
|
||||||
|
|
||||||
## do not optimize image, it will end up larger than original
|
## do not optimize image, it will end up larger than original
|
||||||
filename
|
filename
|
||||||
|
@ -109,7 +109,7 @@ class LetterAvatar
|
||||||
sleep 2
|
sleep 2
|
||||||
cleanup_old
|
cleanup_old
|
||||||
end
|
end
|
||||||
Digest::MD5.hexdigest(`convert --version` << `convert -list font`)
|
Digest::MD5.hexdigest(`magick --version` << `magick -list font`)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -418,7 +418,7 @@ class UploadCreator
|
||||||
|
|
||||||
MAX_CONVERT_FORMAT_SECONDS = 20
|
MAX_CONVERT_FORMAT_SECONDS = 20
|
||||||
def execute_convert(from, to, opts = {})
|
def execute_convert(from, to, opts = {})
|
||||||
command = ["convert", from, "-auto-orient", "-background", "white", "-interlace", "none"]
|
command = ["magick", from, "-auto-orient", "-background", "white", "-interlace", "none"]
|
||||||
command << "-flatten" unless opts[:flatten] == false
|
command << "-flatten" unless opts[:flatten] == false
|
||||||
command << "-debug" << "all" if opts[:debug]
|
command << "-debug" << "all" if opts[:debug]
|
||||||
command << "-quality" << opts[:quality].to_s if opts[:quality]
|
command << "-quality" << opts[:quality].to_s if opts[:quality]
|
||||||
|
@ -526,7 +526,7 @@ class UploadCreator
|
||||||
path = OptimizedImage.prepend_decoder!(path, nil, filename: "image.#{@image_info.type}")
|
path = OptimizedImage.prepend_decoder!(path, nil, filename: "image.#{@image_info.type}")
|
||||||
|
|
||||||
Discourse::Utils.execute_command(
|
Discourse::Utils.execute_command(
|
||||||
"convert",
|
"magick",
|
||||||
path,
|
path,
|
||||||
"-auto-orient",
|
"-auto-orient",
|
||||||
path,
|
path,
|
||||||
|
|
|
@ -35,7 +35,7 @@ Fabricator(:image_upload, from: :upload) do
|
||||||
|
|
||||||
after_create do |upload, transients|
|
after_create do |upload, transients|
|
||||||
file = Tempfile.new(%w[fabricated .png])
|
file = Tempfile.new(%w[fabricated .png])
|
||||||
`convert -size #{upload.width}x#{upload.height} -depth #{transients[:color_depth]} xc:#{transients[:color]} "#{file.path}"`
|
`magick -size #{upload.width}x#{upload.height} -depth #{transients[:color_depth]} xc:#{transients[:color]} "#{file.path}"`
|
||||||
|
|
||||||
upload.url = Discourse.store.store_upload(file, upload)
|
upload.url = Discourse.store.store_upload(file, upload)
|
||||||
upload.sha1 = Upload.generate_digest(file.path)
|
upload.sha1 = Upload.generate_digest(file.path)
|
||||||
|
@ -84,7 +84,7 @@ end
|
||||||
Fabricator(:s3_image_upload, from: :upload_s3) do
|
Fabricator(:s3_image_upload, from: :upload_s3) do
|
||||||
after_create do |upload|
|
after_create do |upload|
|
||||||
file = Tempfile.new(%w[fabricated .png])
|
file = Tempfile.new(%w[fabricated .png])
|
||||||
`convert -size #{upload.width}x#{upload.height} xc:white "#{file.path}"`
|
`magick -size #{upload.width}x#{upload.height} xc:white "#{file.path}"`
|
||||||
|
|
||||||
upload.url = Discourse.store.store_upload(file, upload)
|
upload.url = Discourse.store.store_upload(file, upload)
|
||||||
upload.sha1 = Upload.generate_digest(file.path)
|
upload.sha1 = Upload.generate_digest(file.path)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user