mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
use correct format for svg thumbs
This commit is contained in:
parent
a4e189f51c
commit
c9d14359e7
1 changed files with 11 additions and 2 deletions
|
@ -16,8 +16,11 @@ defmodule PhilomenaWeb.ImageView do
|
||||||
def thumb_url(image, show_hidden, name) do
|
def thumb_url(image, show_hidden, name) do
|
||||||
%{year: year, month: month, day: day} = image.created_at
|
%{year: year, month: month, day: day} = image.created_at
|
||||||
deleted = image.hidden_from_users
|
deleted = image.hidden_from_users
|
||||||
format = String.downcase(image.image_format)
|
|
||||||
root = image_url_root()
|
root = image_url_root()
|
||||||
|
format =
|
||||||
|
image.image_format
|
||||||
|
|> String.downcase()
|
||||||
|
|> thumb_format()
|
||||||
|
|
||||||
id_fragment =
|
id_fragment =
|
||||||
if deleted and show_hidden do
|
if deleted and show_hidden do
|
||||||
|
@ -35,7 +38,10 @@ defmodule PhilomenaWeb.ImageView do
|
||||||
|
|
||||||
view = if download, do: "download", else: "view"
|
view = if download, do: "download", else: "view"
|
||||||
filename = "#{image.id}"
|
filename = "#{image.id}"
|
||||||
format = String.downcase(image.image_format)
|
format =
|
||||||
|
image.image_format
|
||||||
|
|> String.downcase()
|
||||||
|
|> thumb_format()
|
||||||
|
|
||||||
"#{root}/#{view}/#{year}/#{month}/#{day}/#{filename}.#{format}"
|
"#{root}/#{view}/#{year}/#{month}/#{day}/#{filename}.#{format}"
|
||||||
end
|
end
|
||||||
|
@ -82,4 +88,7 @@ defmodule PhilomenaWeb.ImageView do
|
||||||
&1.name
|
&1.name
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp thumb_format("svg"), do: "png"
|
||||||
|
defp thumb_format(format), do: format
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue