Instantly share code, notes, and snippets.

Embed
What would you like to do?
def store(conn, file, album) do
case Images.create_photo(%{album_id: album, image: file}) do
{:ok, photo} ->
header = [{"Content-Type", "application/json"}]
body = "{\"height\": \"250\", \"width\": \"250\", \"bucket\": \"#{album_id}\" }"
HTTPotion.post("https://worker-aws-us-east-1.iron.io/2/projects/{Project ID}/tasks", [body: body, headers: header])
conn
|> put_flash(:info, "Photos created successfully.")
|> redirect(to: album_path(conn, :show, album))
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "new.html", changeset: changeset)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment