mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-22 20:16:57 +00:00
file server images in prod and internet sourced images in other environments
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
defmodule PlantIdDiscordBotTest.Mocks.PlantNet.Images do
|
||||
@moduledoc """
|
||||
Mocks images passed to the PlantNet API. This means that the response will not be the images you have uploaded, but rather the response from the images below.
|
||||
"""
|
||||
def images() do
|
||||
[
|
||||
"https://upload.wikimedia.org/wikipedia/commons/f/ff/Prunus_cerasifera_A.jpg",
|
||||
"https://le-jardin-de-pascal.com/2195113-large_default/prunus-cerasifera-atropurpurea-prunier-myrobolan-nigra.jpg"
|
||||
]
|
||||
end
|
||||
end
|
||||
@@ -52,17 +52,12 @@ defmodule PlantIdDiscordBot.Cog.PlantNet do
|
||||
})
|
||||
end
|
||||
|
||||
# TODO use actual image data
|
||||
image1 =
|
||||
"https://upload.wikimedia.org/wikipedia/commons/f/ff/Prunus_cerasifera_A.jpg"
|
||||
|
||||
image2 =
|
||||
"https://le-jardin-de-pascal.com/2195113-large_default/prunus-cerasifera-atropurpurea-prunier-myrobolan-nigra.jpg"
|
||||
|
||||
images = [image1, image2]
|
||||
|
||||
# production:
|
||||
# images = Enum.map(saved_images, fn {:ok, filename} -> "#{@fileserver_url}/#{filename}" end)
|
||||
images =
|
||||
if Mix.env() in [:test, :dev] do
|
||||
PlantIdDiscordBotTest.Mocks.PlantNet.Images.images()
|
||||
else
|
||||
Enum.map(saved_images, fn {:ok, filename} -> "#{@fileserver_url}/#{filename}" end)
|
||||
end
|
||||
|
||||
Logger.debug(Enum.join(images, ", "))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user