Lazy load all album/artist images
This commit is contained in:
@@ -13,6 +13,7 @@ defmodule MusicLibraryWeb.RecordComponents do
|
|||||||
<img
|
<img
|
||||||
class={@class}
|
class={@class}
|
||||||
alt={@record.title}
|
alt={@record.title}
|
||||||
|
loading="lazy"
|
||||||
src={~p"/covers/#{@record.id}?vsn=#{@record.cover_hash}"}
|
src={~p"/covers/#{@record.id}?vsn=#{@record.cover_hash}"}
|
||||||
/>
|
/>
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -90,6 +90,7 @@
|
|||||||
<div class="flex min-w-0 justify-between space-x-4 items-center">
|
<div class="flex min-w-0 justify-between space-x-4 items-center">
|
||||||
<img
|
<img
|
||||||
class="h-12 w-12 rounded-md shadow-sm"
|
class="h-12 w-12 rounded-md shadow-sm"
|
||||||
|
loading="lazy"
|
||||||
src={album.cover_url}
|
src={album.cover_url}
|
||||||
alt={album.metadata.title}
|
alt={album.metadata.title}
|
||||||
/>
|
/>
|
||||||
@@ -271,6 +272,7 @@
|
|||||||
<div class="flex min-w-0 justify-between space-x-4 items-center">
|
<div class="flex min-w-0 justify-between space-x-4 items-center">
|
||||||
<img
|
<img
|
||||||
class="h-12 w-12 rounded-md shadow-sm"
|
class="h-12 w-12 rounded-md shadow-sm"
|
||||||
|
loading="lazy"
|
||||||
src={track.cover_url}
|
src={track.cover_url}
|
||||||
alt={track.title}
|
alt={track.title}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ defmodule MusicLibraryWeb.StatsLive.TopAlbums do
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
class="w-12 h-12 rounded-md object-cover"
|
class="w-12 h-12 rounded-md object-cover"
|
||||||
|
loading="lazy"
|
||||||
src={album.cover_url}
|
src={album.cover_url}
|
||||||
alt={album.album_title}
|
alt={album.album_title}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ defmodule MusicLibraryWeb.StatsLive.TopArtists do
|
|||||||
<img
|
<img
|
||||||
:if={artist.artist_musicbrainz_id != ""}
|
:if={artist.artist_musicbrainz_id != ""}
|
||||||
class="w-12 h-12 rounded-md object-cover"
|
class="w-12 h-12 rounded-md object-cover"
|
||||||
|
loading="lazy"
|
||||||
src={~p"/artists/#{artist.artist_musicbrainz_id}/image"}
|
src={~p"/artists/#{artist.artist_musicbrainz_id}/image"}
|
||||||
alt={artist.artist_name}
|
alt={artist.artist_name}
|
||||||
onerror={"this.src = '" <> ~p"/images/cover-not-found.png" <> "';"}
|
onerror={"this.src = '" <> ~p"/images/cover-not-found.png" <> "';"}
|
||||||
|
|||||||
Reference in New Issue
Block a user