Supabase Backend as a Service · Lezione

Trasformazioni delle immagini e URL firmati

Serva immagini ridimensionate e ottimizzate al volo e conceda l’accesso temporaneo ai file privati usando gli URL firmati di Supabase Storage.

Lezione 4 di 413 passaggi

Trasformazioni delle immagini e URL firmati è una lezione Supabase Backend as a Service gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Supabase Backend as a Service, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Supabase Backend as a Service include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

Smarter File Delivery

Supabase Storage can transform images on request and create signed URLs for time-limited access to private files. Both reduce custom backend work.

Public vs Private Buckets

Public buckets serve files via a permanent URL. Private buckets require a signed URL or an authenticated request, controlled by policies.

Getting a Public URL

For public buckets, build the URL directly, no token needed.

const { data } = supabase.storage
  .from('avatars')
  .getPublicUrl('user-42.png');
console.log(data.publicUrl);

On-the-Fly Resizing

Pass transform options to request a resized version. Supabase generates and caches it.

const { data } = supabase.storage
  .from('avatars')
  .getPublicUrl('user-42.png', {
    transform: { width: 100, height: 100, resize: 'cover' }
  });

Why Transform at the Edge?

Serving a 100px thumbnail instead of a full-size photo saves bandwidth and speeds up pages, without storing many copies yourself.

Quality and Format

You can also tune quality and request modern formats to shrink payloads further.

function thumbOpts(size) {
  return { width: size, height: size, quality: 75, resize: 'cover' };
}
console.log(thumbOpts(64));

Creating a Signed URL

For private files, generate a URL that expires after a set number of seconds.

const { data } = await supabase.storage
  .from('invoices')
  .createSignedUrl('inv-2026.pdf', 60);
console.log(data.signedUrl);

Choosing an Expiry

Keep expiry as short as the use case allows. A download link might need 60 seconds; an embedded image might need an hour.

function expirySeconds(useCase) {
  return useCase === 'download' ? 60 : 3600;
}
console.log(expirySeconds('download'));

Signed URLs With Transforms

You can combine a signed URL with an image transform to serve resized private images securely.

Caching Behavior

Transformed images are cached at the edge, so repeated requests for the same size are fast. Vary the size sparingly to keep cache hits high.

Putting It Together

Use public URLs and transforms for open assets, and signed URLs for private files, with short expiries and edge caching for performance.

Quick Check

Test your understanding of URLs and transforms.

Recap

You learned to build public URLs, apply on-the-fly image transforms for performance, and create expiring signed URLs for private files, plus how edge caching keeps it fast.

Gratis per iniziare

Impara Supabase Backend as a Service con un tutor IA — gratis

Scrivi ed esegui vero codice nel tuo browser, ricevi aiuto istantaneo da un tutor IA disponibile 24/7, e riprendi da dove hai lasciato sul web o nell'app.

Corsi
11
Lezioni
40

Domande Frequenti

La lezione «Trasformazioni delle immagini e URL firmati» è gratuita?

Sì — il testo completo di «Trasformazioni delle immagini e URL firmati» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Supabase Backend as a Service, passa a CoddyKit PRO. Il corso Supabase Backend as a Service include 4 lezioni in totale.

Cosa imparerò in «Trasformazioni delle immagini e URL firmati»?

Serva immagini ridimensionate e ottimizzate al volo e conceda l’accesso temporaneo ai file privati usando gli URL firmati di Supabase Storage. Eserciti Supabase Backend as a Service con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Supabase Backend as a Service?

Non è richiesta alcuna esperienza precedente. Supabase Backend as a Service su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.

Quanto tempo richiede la lezione «Trasformazioni delle immagini e URL firmati»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Supabase Backend as a Service?

Sì. Ogni lezione Supabase Backend as a Service include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Archiviazione di file nei bucket Supabase
  2. Gestione dell'accesso con le policy
  3. Caricamento e recupero di contenuti multimediali
  4. Trasformazioni delle immagini e URL firmati
← Torna a Supabase Backend as a Service