Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: Waffle changed URL and path generation
fixes #148
  • Loading branch information
Christian Kruse committed Apr 14, 2020
1 parent b20299a commit a48c9b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/dev.exs
Expand Up @@ -62,7 +62,7 @@ config :cforum,
search_dict: "german",
uploads_dir: Path.expand("../priv/uploads", __DIR__),
media_dir: Path.expand("../priv/uploads/pictures", __DIR__),
avatar_dir: Path.expand("../priv/uploads/users/avatars", __DIR__),
avatar_dir: Path.expand("../priv/", __DIR__),
avatar_url: "/uploads/users/avatars",
convert: "/usr/bin/convert",
cfmarkdown: [
Expand Down
6 changes: 5 additions & 1 deletion lib/cforum_web/uploaders/avatar.ex
Expand Up @@ -36,9 +36,13 @@ defmodule CforumWeb.Avatar do
|> Enum.join("/")
end

def storage_dir_prefix() do
Application.get_env(:cforum, :avatar_dir)
end

# Override the storage directory:
def storage_dir(version, {_, scope}) do
"#{Application.get_env(:cforum, :avatar_dir)}/#{id_partition(scope.user_id)}/#{version}/"
"#{Application.get_env(:cforum, :avatar_url)}/#{id_partition(scope.user_id)}/#{version}/"
end

# Provide a default URL if there hasn't been a file uploaded
Expand Down

0 comments on commit a48c9b9

Please sign in to comment.