Link copied!
Cats of Riga 🐈⬛
1
Spot Riga’s famous Cat House: An Art Nouveau gem guarded by two giant cats on its turrets.
{
const file = $refs.activityFile.files[0];
if (!file) {
console.error('No file selected.');
return;
}
if (file.type.startsWith('image/')) {
new Compressor(file, {
quality: 0.8,
maxWidth: 2000,
maxHeight: 2000,
retainExif: true,
mimeType: 'image/jpeg',
success(compressedFile) {
Alpine.store('uploader').uploadFile(compressedFile, $wire, $data);
},
error(err) {
console.error('Compression error:', err.message);
},
});
} else if (file.type.startsWith('video/')) {
const video = document.createElement('video');
video.preload = 'metadata';
video.src = URL.createObjectURL(file);
video.onloadedmetadata = () => {
URL.revokeObjectURL(video.src); // clean up
console.log(video.duration);
if (video.duration > 30) {
Alpine.store('videoUpload').file = file;
Alpine.store('videoUpload').previewUrl = URL.createObjectURL(file);
Alpine.store('uploader').componentId = $wire.__instance.id;
$dispatch('open-modal', {
modal: 'trim-activity-video',
params: {
activityId: 18,
fileName: file.name,
fileSize: file.size
},
fullscreen: true
});
$refs.activityFile.value = ''; // Resetting the activityFile input value since we anyway have it in the store. Reason being, so the user can select the same file again if they choose to close the modal.
} else {
Alpine.store('uploader').uploadFile(file, $wire, $data);
}
}
} else {
console.error('Unsupported file type:', file.type);
}
}"
>
2
Show us the coolest cat souvenir in Riga!
3
Around Riga, in the old town, there is a CAT HOTEL! Can you find it?
4
FLOW is the most popular movie in Latvia, find the cat FLOW around the city and take a photo with it!
5