diff --git a/app/components/GalleryModal.vue b/app/components/GalleryModal.vue index 5c13c67..db1d18f 100644 --- a/app/components/GalleryModal.vue +++ b/app/components/GalleryModal.vue @@ -9,6 +9,22 @@ const props = defineProps<{ const emit = defineEmits<{ close: [number] }>(); const currentIndex = ref(props.initialIndex); + +const shouldLoad = (index: number) => { + return Math.abs(index - currentIndex.value) <= 2; +}; + +const getPlaceholder = (image: InternalApi["/api/gallery"]["get"][number]) => { + const aspectRatio = image.height / image.width; + const placeholderWidth = 600; + const placeholderHeight = Math.round(aspectRatio * placeholderWidth); + return [placeholderWidth, placeholderHeight, 70, 3] as [ + width: number, + height: number, + quality: number, + blur: number, + ]; +};