From c9d14359e7353a7e1eb8d6655ec39504f475beee Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sat, 16 Nov 2019 22:19:20 -0500 Subject: [PATCH] use correct format for svg thumbs --- lib/philomena_web/views/image_view.ex | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/philomena_web/views/image_view.ex b/lib/philomena_web/views/image_view.ex index 169d155f..979f92af 100644 --- a/lib/philomena_web/views/image_view.ex +++ b/lib/philomena_web/views/image_view.ex @@ -16,8 +16,11 @@ defmodule PhilomenaWeb.ImageView do def thumb_url(image, show_hidden, name) do %{year: year, month: month, day: day} = image.created_at deleted = image.hidden_from_users - format = String.downcase(image.image_format) root = image_url_root() + format = + image.image_format + |> String.downcase() + |> thumb_format() id_fragment = if deleted and show_hidden do @@ -35,7 +38,10 @@ defmodule PhilomenaWeb.ImageView do view = if download, do: "download", else: "view" filename = "#{image.id}" - format = String.downcase(image.image_format) + format = + image.image_format + |> String.downcase() + |> thumb_format() "#{root}/#{view}/#{year}/#{month}/#{day}/#{filename}.#{format}" end @@ -82,4 +88,7 @@ defmodule PhilomenaWeb.ImageView do &1.name }) end + + defp thumb_format("svg"), do: "png" + defp thumb_format(format), do: format end