projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/develop' into reactions
[akkoma]
/
lib
/
pleroma
/
upload
/
filter
/
mogrify.ex
diff --git
a/lib/pleroma/upload/filter/mogrify.ex
b/lib/pleroma/upload/filter/mogrify.ex
index f106bd4b19e882d4c5b70094b2e05c72f65968ff..91bfdd4f5bdf7157a8036ad9c8ecfe6c78d203f8 100644
(file)
--- a/
lib/pleroma/upload/filter/mogrify.ex
+++ b/
lib/pleroma/upload/filter/mogrify.ex
@@
-1,3
+1,7
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Upload.Filter.Mogrify do
@behaviour Pleroma.Upload.Filter
defmodule Pleroma.Upload.Filter.Mogrify do
@behaviour Pleroma.Upload.Filter
@@
-7,16
+11,19
@@
defmodule Pleroma.Upload.Filter.Mogrify do
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
filters = Pleroma.Config.get!([__MODULE__, :args])
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
filters = Pleroma.Config.get!([__MODULE__, :args])
+ do_filter(file, filters)
+ :ok
+ end
+
+ def filter(_), do: :ok
+
+ def do_filter(file, filters) do
file
|> Mogrify.open()
|> mogrify_filter(filters)
|> Mogrify.save(in_place: true)
file
|> Mogrify.open()
|> mogrify_filter(filters)
|> Mogrify.save(in_place: true)
-
- :ok
end
end
- def filter(_), do: :ok
-
defp mogrify_filter(mogrify, nil), do: mogrify
defp mogrify_filter(mogrify, [filter | rest]) do
defp mogrify_filter(mogrify, nil), do: mogrify
defp mogrify_filter(mogrify, [filter | rest]) do