Skip to content

Commit 7c7ab04

Browse files
committed
Improve image sizing for play-lh images
1 parent f2d4a84 commit 7c7ab04

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/plexus_web/components/core_components.ex

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ defmodule PlexusWeb.CoreComponents do
1818
use Gettext, backend: PlexusWeb.Gettext
1919

2020
alias Phoenix.LiveView.JS
21+
alias Plexus.Schemas.App
2122
alias Plexus.Schemas.Score
2223

2324
@doc """
@@ -627,6 +628,9 @@ defmodule PlexusWeb.CoreComponents do
627628
"""
628629
end
629630

631+
defp icon_url(%App{icon_url: url = "https://play-lh" <> _}), do: url <> "=w96-h96"
632+
defp icon_url(%App{icon_url: url}), do: url
633+
630634
def card(assigns) do
631635
assigns =
632636
assigns
@@ -641,7 +645,7 @@ defmodule PlexusWeb.CoreComponents do
641645
<div class="flex">
642646
<div class="aspect-h-1 aspect-w-1 w-24 h-24 bg-white overflow-hidden">
643647
<img
644-
src={@app.icon_url}
648+
src={icon_url(@app)}
645649
alt={@app.name <> " Icon"}
646650
class="h-full w-full object-cover object-center"
647651
/>

0 commit comments

Comments
 (0)