philomena/lib/philomena_web/controllers/search/reverse_controller.ex
2019-12-03 19:50:23 -05:00

18 lines
No EOL
463 B
Elixir

defmodule PhilomenaWeb.Search.ReverseController do
use PhilomenaWeb, :controller
alias PhilomenaWeb.ImageReverse
plug PhilomenaWeb.ScraperPlug, [params_key: "image", params_name: "image"] when action in [:create]
def index(conn, _params) do
render(conn, "index.html", images: nil)
end
def create(conn, %{"image" => image_params}) do
images = ImageReverse.images(image_params)
conn
|> render("index.html", images: images)
end
end