Merge pull request #337 from mdashlw/reverse-fix

Some reverse search fixes
This commit is contained in:
liamwhite 2024-07-22 12:22:55 -04:00 committed by GitHub
commit 08d74b9be6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View file

@ -37,6 +37,16 @@ defmodule Philomena.DuplicateReports.SearchQuery do
:image_aspect_ratio, :image_aspect_ratio,
:uploaded_image :uploaded_image
]) ])
|> validate_required([
:image_width,
:image_height,
:image_format,
:image_duration,
:image_mime_type,
:image_is_animated,
:image_aspect_ratio,
:uploaded_image
])
|> validate_number(:image_width, greater_than: 0) |> validate_number(:image_width, greater_than: 0)
|> validate_number(:image_height, greater_than: 0) |> validate_number(:image_height, greater_than: 0)
|> validate_inclusion( |> validate_inclusion(

View file

@ -13,7 +13,7 @@ h1 Reverse Search
p Upload a file from your computer, or provide a link to the page containing the image and click Fetch. p Upload a file from your computer, or provide a link to the page containing the image and click Fetch.
.field .field
= file_input f, :image, class: "input js-scraper" = file_input f, :image, class: "input js-scraper"
= error_tag f, :image = error_tag f, :uploaded_image
= error_tag f, :image_width = error_tag f, :image_width
= error_tag f, :image_height = error_tag f, :image_height
= error_tag f, :image_mime_type = error_tag f, :image_mime_type
@ -40,7 +40,7 @@ h1 Reverse Search
= cond do = cond do
- is_nil(@images) -> - is_nil(@images) ->
- Enum.any?(@images) -> - Enum.any?(@images) ->
h2 Results h2 Results
@ -49,7 +49,7 @@ h1 Reverse Search
th   th  
th Image th Image
th   th  
= for match <- @images do = for match <- @images do
tr tr
th th