mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-23 12:36:58 +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
|
end
|
||||||
|
|
||||||
# TODO use actual image data
|
images =
|
||||||
image1 =
|
if Mix.env() in [:test, :dev] do
|
||||||
"https://upload.wikimedia.org/wikipedia/commons/f/ff/Prunus_cerasifera_A.jpg"
|
PlantIdDiscordBotTest.Mocks.PlantNet.Images.images()
|
||||||
|
else
|
||||||
image2 =
|
Enum.map(saved_images, fn {:ok, filename} -> "#{@fileserver_url}/#{filename}" end)
|
||||||
"https://le-jardin-de-pascal.com/2195113-large_default/prunus-cerasifera-atropurpurea-prunier-myrobolan-nigra.jpg"
|
end
|
||||||
|
|
||||||
images = [image1, image2]
|
|
||||||
|
|
||||||
# production:
|
|
||||||
# images = Enum.map(saved_images, fn {:ok, filename} -> "#{@fileserver_url}/#{filename}" end)
|
|
||||||
|
|
||||||
Logger.debug(Enum.join(images, ", "))
|
Logger.debug(Enum.join(images, ", "))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user