Refactor image loader URL in loader.js

This commit is contained in:
Andras Bacsai
2024-04-24 11:10:22 +02:00
parent b56754c84f
commit 9cce2ed824

View File

@@ -8,7 +8,16 @@ export default function myImageLoader({ src, width, quality }) {
if (isLocal) { if (isLocal) {
const baseUrl = 'https://xoos0kk.heyandras.dev'; const baseUrl = 'https://xoos0kk.heyandras.dev';
const fullSrc = `${baseUrl}${src}`; const fullSrc = `${baseUrl}${src}`;
return `https://images.coollabs.io/o/${fullSrc}?width=${width}&quality=${quality || 75}` if (quality) {
return `https://images.coollabs.io/o/${fullSrc}?width=${width}&quality=${quality}`
} else {
return `https://images.coollabs.io/o/${fullSrc}?width=${width}`
}
} }
return `https://images.coollabs.io/o/${src}?width=${width}&quality=${quality|| 75}` if (quality) {
return `https://images.coollabs.io/o/${src}?width=${width}&quality=${quality}`
} else {
return `https://images.coollabs.io/o/${src}?width=${width}`
}
} }