mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-20 14:47:58 +01:00
24 lines
616 B
Elixir
24 lines
616 B
Elixir
defmodule Philomena.Badges.Uploader do
|
|
@moduledoc """
|
|
Upload and processing callback logic for Badge images.
|
|
"""
|
|
|
|
alias Philomena.Badges.Badge
|
|
alias Philomena.Uploader
|
|
|
|
def analyze_upload(badge, params) do
|
|
Uploader.analyze_upload(badge, "image", params["image"], &Badge.image_changeset/2)
|
|
end
|
|
|
|
def persist_upload(badge) do
|
|
Uploader.persist_upload(badge, badge_file_root(), "image")
|
|
end
|
|
|
|
def unpersist_old_upload(badge) do
|
|
Uploader.unpersist_old_upload(badge, badge_file_root(), "image")
|
|
end
|
|
|
|
defp badge_file_root do
|
|
Application.get_env(:philomena, :badge_file_root)
|
|
end
|
|
end
|