Skip to content

A self-hosted media server and file management system

fix: music poster size and alt broken when image fails to load

aminnausinfbb12d105021
diff --git a/resources/js/components/icons/ProIconsPhotoOff.vue b/resources/js/components/icons/ProIconsPhotoOff.vue
new file mode 100644
index 00000000..7622d2c6
--- /dev/null
+++ b/resources/js/components/icons/ProIconsPhotoOff.vue
@@ -0,0 +1,15 @@
+<template>
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+ <g fill="none">
+ <path
+ stroke="currentColor"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="1.5"
+ d="M20.33 17.657c.11-.366.17-.755.17-1.157v-9a4 4 0 0 0-4-4h-9a4 4 0 0 0-4 4v9.07m16.83 1.087l-.088-.104l-2.466-2.976a2 2 0 0 0-3.073-.008l-1.312 1.566l-.214.261m7.153 1.26a4 4 0 0 1-3.713 2.842m0 0l-.117.002h-9a4 4 0 0 1-4-3.93m13.117 3.928l-.093-.106l-3.347-3.996m-9.676.175l.177-.201l3.206-3.827a2 2 0 0 1 3.066 0l3.227 3.853"
+ />
+ <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 3l18 18 " />
+ <circle cx="15.091" cy="8.909" r="1.5" fill="currentColor" />
+ </g>
+ </svg>
+</template>
diff --git a/resources/js/components/lazy/LazyImage.vue b/resources/js/components/lazy/LazyImage.vue
index f0a7a4ff..dfd17dab 100644
--- a/resources/js/components/lazy/LazyImage.vue
+++ b/resources/js/components/lazy/LazyImage.vue
@@ -5,6 +5,8 @@ import { SvgSpinners90RingWithBg } from '@/components/cedar-ui/icons';
import { ref, useAttrs, watch } from 'vue';
import { cn } from '@aminnausin/cedar-ui';
+import ProIconsPhotoOff from '@/components/icons/ProIconsPhotoOff.vue';
+
defineOptions({ inheritAttrs: false });
const props = withDefaults(defineProps<{ src?: string; alt?: string; loading?: ImgHTMLAttributes['loading']; wrapperClass?: HTMLAttributes['class'] }>(), { loading: 'lazy' });
@@ -26,10 +28,13 @@ watch(
<div v-show="src && isLoading && !isError" class="absolute inset-0 flex items-center justify-center">
<SvgSpinners90RingWithBg class="size-4" />
</div>
+ <div v-show="isError && !isLoading" class="absolute inset-0 flex items-center justify-center gap-1 pb-6">
+ <ProIconsPhotoOff class="size-5" />Image failed to load ({{ alt }})
+ </div>
<img
v-bind="attrs"
:loading="loading"
- :alt="alt"
+ :alt="isError ? '' : alt"
:src="src"
:class="[{ 'scale-85 opacity-0': isLoading }, 'lazy-image ease-in-out']"
@load="
diff --git a/resources/js/components/video/PlayerBackdrop.vue b/resources/js/components/video/PlayerBackdrop.vue
index f10237d2..4a9ae8a8 100644
--- a/resources/js/components/video/PlayerBackdrop.vue
+++ b/resources/js/components/video/PlayerBackdrop.vue
@@ -43,9 +43,9 @@ const generatePosterStyle = (url?: string): HTMLAttributes['style'] => {
></div>
<LazyImage
:src="audioPosterUrl"
- alt="Album Art"
+ alt="album art"
wrapper-class="flex items-center justify-center"
- :class="['mx-auto object-contain select-none md:h-screen', { 'max-h-[71vh]': isPlayerSizeConstrained }, { 'max-h-screen': isTheatreView }]"
+ :class="['mx-auto min-h-[32dvh] object-contain select-none md:h-screen', { 'max-h-[71vh]': isPlayerSizeConstrained }, { 'max-h-screen': isTheatreView }]"
loading="eager"
fetchpriority="high"
/>
@@ -54,7 +54,7 @@ const generatePosterStyle = (url?: string): HTMLAttributes['style'] => {
<div id="thumbnail-blocker" class="absolute inset-0 scale-105 blur-sm" :style="generatePosterStyle(posterUrl)"></div>
<LazyImage
:src="handleStorageURL(posterUrl) ?? ''"
- alt="Thumbnail"
+ alt="thumbnail"
:class="['mx-auto h-full object-contain transition-all', { 'max-h-[71vh]': isPlayerSizeConstrained }]"
loading="eager"
fetchpriority="high"