Attached.Web.UrlHelpers (Attached v0.1.0)

Copy Markdown View Source

Template helpers for rendering attachment URLs.

Usage

Import in your web module:

defmodule MyAppWeb do
  def html_helpers do
    quote do
      import Attached.Web.UrlHelpers
    end
  end
end

Then in templates:

<img src={storage_url(@user, :avatar)} />
<img src={storage_url(@user, :avatar, :thumb)} />

Summary

Functions

Returns the URL for an attachment, or nil if nothing is attached.

Functions

storage_url(record, field, variant \\ nil)

Returns the URL for an attachment, or nil if nothing is attached.

storage_url(user, :avatar)
storage_url(user, :avatar, :thumb)