The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs: storage lw6
fenoscb4d130edc66
diff --git a/apps/docs/pages/guides/storage/cdn.mdx b/apps/docs/pages/guides/storage/cdn.mdxindex e54a8d3df4e..bac2f3d9fc4 100644--- a/apps/docs/pages/guides/storage/cdn.mdx+++ b/apps/docs/pages/guides/storage/cdn.mdx@@ -30,11 +30,12 @@ For example, you can use a URL like `/storage/v1/object/sign/profile-pictures/caWhen you want to update the cat picture, you can increment the version query parameter in the URL. The CDN treats `/storage/v1/object/sign/profile-pictures/cat.jpg?token=eyJh...&version=2` as a new object and pings the origin for the updated version.+If your asset is updated frequently, we recommend that you re-upload the new asset in a different key, this way you'll always have the latest changes available immediately.+Note that CDNs might still evict your object from their cache if it has not been requested for a while from a specific region. For example, if no user from United States requests your object, it will be removed from the CDN cache even if you set a very long cache control duration.The cache status of a particular request is sent in the `cf-cache-status` header. A cache status of `MISS` indicates that the CDN node did not have the object in its cache and had to ping the origin to get it. A cache status of `HIT` indicates that the object was sent directly from the CDN.-## Smart CDN Caching<Admonition type="note">@@ -54,7 +55,9 @@ It can take **up to 60 seconds** for the CDN cache to be invalidated as it has tWhen an asset is invalidated at the CDN level, it doesn't affect browser caching.If you don't see the changes, make sure the browser cache has been updated.-If your asset is updated frequently, we recommend setting a low browser TTL value using the `cacheControl` option when using smart CDN caching.++If your asset is updated frequently, we recommend that you re-upload the new asset in a different key, this way you'll always have the latest changes available without waiting the propagation delay.+If your expect your asset to be deleted, we recommend setting a low browser TTL value using the `cacheControl` option when using smart CDN caching, the default is 1hour which generally is a good default.## Public vs Private Bucketsdiff --git a/apps/docs/pages/guides/storage/image-resizing.mdx b/apps/docs/pages/guides/storage/image-resizing.mdxindex cdfbfd3a729..10cc6eef6e3 100644--- a/apps/docs/pages/guides/storage/image-resizing.mdx+++ b/apps/docs/pages/guides/storage/image-resizing.mdx@@ -59,6 +59,48 @@ supabase.storage.from('bucket').download('image.jpg', {})```+## Next JS Loader++You can use Supabase Image Transformation to optimise your NextJS images using a custom [Loader](https://nextjs.org/docs/api-reference/next/image#loader-configuration).++To get started, create a `supabase-image-loader.js` file in your NextJS project which exports a default function:++```ts+const projectId = '' // your supabase project id++export default function supabaseLoader({ src, width, height, quality }) {+ return `https://${projectId}.supabase.co/storage/v1/${src}?width=${width}&height=${height || 0}&quality=${quality || 75}`+}+```++In your `nextjs.config.js` file add the following configuration to instruct NextJS to use our custom loader++```js+module.exports = {+ images: {+ loader: 'custom',+ loaderFile: './supabase-image-loader.js',+ },+}+```++At this point you are ready to use the `Image` component provided by NextJS++```tsx+import Image from 'next/image'++const MyImage = (props) => {+ return (+ <Image+ src="bucket/image.png"+ alt="Picture of the author"+ width={500}+ height={500}+ />+ )+}+```+## Transformation optionsWe currently support a few transformation options focusing on resizing and cropping images.