mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
24 lines
631 B
Elixir
24 lines
631 B
Elixir
defmodule Philomena.Adverts.Uploader do
|
|
@moduledoc """
|
|
Upload and processing callback logic for Advert images.
|
|
"""
|
|
|
|
alias Philomena.Adverts.Advert
|
|
alias Philomena.Uploader
|
|
|
|
def analyze_upload(advert, params) do
|
|
Uploader.analyze_upload(advert, "image", params["image"], &Advert.image_changeset/2)
|
|
end
|
|
|
|
def persist_upload(advert) do
|
|
Uploader.persist_upload(advert, advert_file_root(), "image")
|
|
end
|
|
|
|
def unpersist_old_upload(advert) do
|
|
Uploader.unpersist_old_upload(advert, advert_file_root(), "image")
|
|
end
|
|
|
|
defp advert_file_root do
|
|
Application.get_env(:philomena, :advert_file_root)
|
|
end
|
|
end
|