]
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
- Filter.Mogrify.do_filter(file, [Enum.random(@filters)])
-
- :ok
+ if Pleroma.Utils.command_available?("mogrify") do
+ Filter.Mogrify.do_filter(file, [Enum.random(@filters)])
+ :ok
+ else
+ {:error, "mogrify command not found"}
+ end
end
def filter(_), do: :ok
@type conversions :: conversion() | [conversion()]
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
- filters = Pleroma.Config.get!([__MODULE__, :args])
-
- do_filter(file, filters)
- :ok
+ if Pleroma.Utils.command_available?("mogrify") do
+ filters = Pleroma.Config.get!([__MODULE__, :args])
+
+ do_filter(file, filters)
+ :ok
+ else
+ {:error, "mogrify command not found"}
+ end
end
def filter(_), do: :ok