#11 - optimize images and preload

This commit is contained in:
isUnknown 2024-12-17 11:27:02 +01:00
parent b391075efd
commit f158f99fc5
2 changed files with 17 additions and 2 deletions

View file

@ -3,7 +3,11 @@
function getFileData($file) {
$data = [
'modified' => $file->modified('YYYY-MM-dd'),
'url' => $file->url(),
'url' => $file->thumb([
'width' => 1000,
'quality' => 80,
'format' => 'webp'
])->url(),
'uuid' => (string) $file->uuid(),
'name' => $file->filename(),
'label' => (string) $file->label(),

View file

@ -30,11 +30,22 @@ const { activeTrack } = defineProps({
activeTrack: Object,
});
// Helper
const virtualSampleStore = useVirtualSampleStore();
const isHelperHidden = ref(localStorage.getItem("isHelperHidden"));
localStorage.setItem("isHelperHidden", true);
// Images preload
const imageUrls = activeTrack.files.map((file) => file.url);
preloadImages(imageUrls);
function preloadImages(imageUrls) {
imageUrls.forEach((imageUrl) => {
const image = new Image();
image.src = imageUrl;
});
}
// Grab interaction
const yMax = computed(() => {
return parseInt(
activeTrack.files[activeTrack.files.length - 1].name.charAt(0)