philomena/lib/philomena_web/templates/search/reverse/index.html.slime

77 lines
2.3 KiB
Text
Raw Normal View History

2019-11-29 01:11:05 +01:00
h1 Reverse Search
= form_for :image, ~p"/search/reverse", [multipart: true], fn f ->
2019-11-29 01:11:05 +01:00
p
' Basic image similarity search. Finds uploaded images similar to the one
2020-01-11 19:50:53 +01:00
' provided based on simple intensities and uses the median frame of
' animations; very low contrast images (such as sketches) will produce
' poor results and, regardless of contrast, results may include seemingly
' random images that look very different.
2019-11-29 01:11:05 +01:00
.image-other
#js-image-upload-previews
p Upload a file from your computer, or provide a link to the page containing the image and click Fetch.
.field
= file_input f, :image, class: "input js-scraper"
.field.field--inline
2020-01-11 19:50:53 +01:00
= url_input f, :url, name: "url", class: "input input--wide js-scraper", placeholder: "Link a deviantART page, a Tumblr post, or the image directly"
button.button.button--separate-left#js-scraper-preview(type="button" title="Fetch the image at the specified URL" data-disable-with="Fetch" disabled)
2019-11-29 01:11:05 +01:00
' Fetch
.field-error-js.hidden.js-scraper
h4 Optional settings
.field
= label f, :distance, "Match distance (suggested values: between 0.2 and 0.5)"
br
= number_input f, :distance, value: 0.25, min: 0, max: 1, step: 0.01, class: "input"
2019-11-29 01:11:05 +01:00
= hidden_input f, :limit, value: 10
2019-11-29 01:11:05 +01:00
.field
= submit "Reverse Search", class: "button"
= cond do
- is_nil(@images) ->
- Enum.any?(@images) ->
h2 Results
table
tr
th  
th Image
th  
= for match <- @images do
tr
2019-11-29 01:34:22 +01:00
th
h3 = link "##{match.id}", to: ~p"/images/#{match}"
2019-11-29 01:11:05 +01:00
p
= if image_has_sources(match) do
2019-11-29 01:11:05 +01:00
span.source_url
= link "Source", to: image_first_source(match)
2019-11-29 01:11:05 +01:00
- else
' Unknown source
2019-11-29 01:34:22 +01:00
th
2019-11-29 01:11:05 +01:00
= render PhilomenaWeb.ImageView, "_image_container.html", image: match, size: :thumb, conn: @conn
2019-11-29 01:34:22 +01:00
th
2019-11-29 01:11:05 +01:00
h3
= match.image_width
| x
=> match.image_height
' -
=> round(match.image_size / 1024)
' KiB
2019-12-06 18:12:55 +01:00
= render PhilomenaWeb.TagView, "_tag_list.html", tags: Tag.display_order(match.tags), conn: @conn
2019-11-29 01:11:05 +01:00
- true ->
h2 Results
p
2020-01-11 19:50:53 +01:00
' We couldn't find any images matching this in our image database.