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