Skip to content

Commit

Permalink
Improve image sizing for play-lh images
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkonidas committed Jan 8, 2025
1 parent f2d4a84 commit 7c7ab04
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/plexus_web/components/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ defmodule PlexusWeb.CoreComponents do
use Gettext, backend: PlexusWeb.Gettext

alias Phoenix.LiveView.JS
alias Plexus.Schemas.App
alias Plexus.Schemas.Score

@doc """
Expand Down Expand Up @@ -627,6 +628,9 @@ defmodule PlexusWeb.CoreComponents do
"""
end

defp icon_url(%App{icon_url: url = "https://play-lh" <> _}), do: url <> "=w96-h96"
defp icon_url(%App{icon_url: url}), do: url

def card(assigns) do
assigns =
assigns
Expand All @@ -641,7 +645,7 @@ defmodule PlexusWeb.CoreComponents do
<div class="flex">
<div class="aspect-h-1 aspect-w-1 w-24 h-24 bg-white overflow-hidden">
<img
src={@app.icon_url}
src={icon_url(@app)}
alt={@app.name <> " Icon"}
class="h-full w-full object-cover object-center"
/>
Expand Down

0 comments on commit 7c7ab04

Please sign in to comment.