mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-17 11:04:22 +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
|
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
|
def thumbnail_urls(image, hidden_key) do
|
||||||
Path.join([image_thumb_dir(image), "*"])
|
Path.join([image_thumb_dir(image), "*"])
|
||||||
|> Path.wildcard()
|
|> Path.wildcard()
|
||||||
|
|
|
@ -2,6 +2,7 @@ defmodule PhilomenaWeb.ImageView do
|
||||||
use PhilomenaWeb, :view
|
use PhilomenaWeb, :view
|
||||||
|
|
||||||
alias Philomena.Tags.Tag
|
alias Philomena.Tags.Tag
|
||||||
|
alias Philomena.Images.Thumbnailer
|
||||||
|
|
||||||
def show_vote_counts?(%{hide_vote_counts: true}), do: false
|
def show_vote_counts?(%{hide_vote_counts: true}), do: false
|
||||||
def show_vote_counts?(_user), do: true
|
def show_vote_counts?(_user), do: true
|
||||||
|
@ -45,16 +46,14 @@ defmodule PhilomenaWeb.ImageView do
|
||||||
end
|
end
|
||||||
|
|
||||||
def thumb_urls(image, show_hidden) do
|
def thumb_urls(image, show_hidden) do
|
||||||
%{
|
Thumbnailer.thumbnail_versions()
|
||||||
thumb_tiny: thumb_url(image, show_hidden, :thumb_tiny),
|
|> Map.new(fn {name, {width, height}} ->
|
||||||
thumb_small: thumb_url(image, show_hidden, :thumb_small),
|
if image.image_width > width or image.image_height > height do
|
||||||
thumb: thumb_url(image, show_hidden, :thumb),
|
{name, thumb_url(image, show_hidden, name)}
|
||||||
small: thumb_url(image, show_hidden, :small),
|
else
|
||||||
medium: thumb_url(image, show_hidden, :medium),
|
{name, thumb_url(image, show_hidden, :full)}
|
||||||
large: thumb_url(image, show_hidden, :large),
|
end
|
||||||
tall: thumb_url(image, show_hidden, :tall),
|
end)
|
||||||
full: pretty_url(image, true, false)
|
|
||||||
}
|
|
||||||
|> append_full_url(image, show_hidden)
|
|> append_full_url(image, show_hidden)
|
||||||
|> append_gif_urls(image, show_hidden)
|
|> append_gif_urls(image, show_hidden)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue