mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
18 lines
514 B
Elixir
18 lines
514 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", title: "Reverse Search", images: nil)
|
|
end
|
|
|
|
def create(conn, %{"image" => image_params}) do
|
|
images = ImageReverse.images(image_params)
|
|
|
|
conn
|
|
|> render("index.html", title: "Reverse Search", images: images)
|
|
end
|
|
end
|