Move arg for images to the list so we can reuse these fifo functions for videos

This commit is contained in:
Mark Felder 2020-08-26 17:43:25 -05:00
parent 9567b96c79
commit 697bea0473

View File

@ -29,7 +29,8 @@ defmodule Pleroma.Helpers.MediaHelper do
args = [ args = [
"-interlace", "Plane", "-interlace", "Plane",
"-resize", resize, "-resize", resize,
"-quality", to_string(quality) "-quality", to_string(quality),
"jpg:-"
] ]
{:ok, args} {:ok, args}
end end
@ -37,7 +38,7 @@ defmodule Pleroma.Helpers.MediaHelper do
defp prepare_image_resize_args(_), do: {:error, :missing_options} defp prepare_image_resize_args(_), do: {:error, :missing_options}
defp run_fifo(fifo_path, env, executable, args) do defp run_fifo(fifo_path, env, executable, args) do
args = List.flatten([fifo_path, args, "jpg:-"]) args = List.flatten([fifo_path, args])
pid = Port.open({:spawn_executable, executable}, [:use_stdio, :stream, :exit_status, :binary, args: args]) pid = Port.open({:spawn_executable, executable}, [:use_stdio, :stream, :exit_status, :binary, args: args])
fifo = Port.open(to_charlist(fifo_path), [:eof, :binary, :stream, :out]) fifo = Port.open(to_charlist(fifo_path), [:eof, :binary, :stream, :out])
true = Port.command(fifo, env.body) true = Port.command(fifo, env.body)