forked from AkkomaGang/akkoma
Rename to make it obvious this is for images not videos
This commit is contained in:
parent
2cfe2dc81b
commit
9567b96c79
1 changed files with 3 additions and 3 deletions
|
@ -11,7 +11,7 @@ defmodule Pleroma.Helpers.MediaHelper do
|
||||||
|
|
||||||
def image_resize(url, options) do
|
def image_resize(url, options) do
|
||||||
with executable when is_binary(executable) <- System.find_executable("convert"),
|
with executable when is_binary(executable) <- System.find_executable("convert"),
|
||||||
{:ok, args} <- prepare_resize_args(options),
|
{:ok, args} <- prepare_image_resize_args(options),
|
||||||
url = Pleroma.Web.MediaProxy.url(url),
|
url = Pleroma.Web.MediaProxy.url(url),
|
||||||
{:ok, env} <- Pleroma.HTTP.get(url),
|
{:ok, env} <- Pleroma.HTTP.get(url),
|
||||||
{:ok, fifo_path} <- mkfifo()
|
{:ok, fifo_path} <- mkfifo()
|
||||||
|
@ -23,7 +23,7 @@ def image_resize(url, options) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp prepare_resize_args(%{max_width: max_width, max_height: max_height} = options) do
|
defp prepare_image_resize_args(%{max_width: max_width, max_height: max_height} = options) do
|
||||||
quality = options[:quality] || 85
|
quality = options[:quality] || 85
|
||||||
resize = Enum.join([max_width, "x", max_height, ">"])
|
resize = Enum.join([max_width, "x", max_height, ">"])
|
||||||
args = [
|
args = [
|
||||||
|
@ -34,7 +34,7 @@ defp prepare_resize_args(%{max_width: max_width, max_height: max_height} = optio
|
||||||
{:ok, args}
|
{:ok, args}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp prepare_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, "jpg:-"])
|
||||||
|
|
Loading…
Reference in a new issue