mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
obj storage prep: skip generating urls for symlink version targets
This commit is contained in:
parent
d49fadf15b
commit
de8001a1ff
2 changed files with 15 additions and 10 deletions
|
@ -22,6 +22,12 @@ defmodule Philomena.Images.Thumbnailer do
|
|||
full: nil
|
||||
]
|
||||
|
||||
def thumbnail_versions do
|
||||
Enum.filter(@versions, fn {_name, dimensions} ->
|
||||
not is_nil(dimensions)
|
||||
end)
|
||||
end
|
||||
|
||||
def thumbnail_urls(image, hidden_key) do
|
||||
Path.join([image_thumb_dir(image), "*"])
|
||||
|> Path.wildcard()
|
||||
|
|
|
@ -2,6 +2,7 @@ defmodule PhilomenaWeb.ImageView do
|
|||
use PhilomenaWeb, :view
|
||||
|
||||
alias Philomena.Tags.Tag
|
||||
alias Philomena.Images.Thumbnailer
|
||||
|
||||
def show_vote_counts?(%{hide_vote_counts: true}), do: false
|
||||
def show_vote_counts?(_user), do: true
|
||||
|
@ -45,16 +46,14 @@ defmodule PhilomenaWeb.ImageView do
|
|||
end
|
||||
|
||||
def thumb_urls(image, show_hidden) do
|
||||
%{
|
||||
thumb_tiny: thumb_url(image, show_hidden, :thumb_tiny),
|
||||
thumb_small: thumb_url(image, show_hidden, :thumb_small),
|
||||
thumb: thumb_url(image, show_hidden, :thumb),
|
||||
small: thumb_url(image, show_hidden, :small),
|
||||
medium: thumb_url(image, show_hidden, :medium),
|
||||
large: thumb_url(image, show_hidden, :large),
|
||||
tall: thumb_url(image, show_hidden, :tall),
|
||||
full: pretty_url(image, true, false)
|
||||
}
|
||||
Thumbnailer.thumbnail_versions()
|
||||
|> Map.new(fn {name, {width, height}} ->
|
||||
if image.image_width > width or image.image_height > height do
|
||||
{name, thumb_url(image, show_hidden, name)}
|
||||
else
|
||||
{name, thumb_url(image, show_hidden, :full)}
|
||||
end
|
||||
end)
|
||||
|> append_full_url(image, show_hidden)
|
||||
|> append_gif_urls(image, show_hidden)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue