Skip to content

useStorageTransformUrl

useStorageTransformUrl(bucket, path, transform): string | null

Hook to get a public URL for an image with transformations applied

Only works for image files (JPEG, PNG, WebP, GIF, AVIF, etc.)

ParameterTypeDescription
bucketstringThe storage bucket name
pathnull | stringThe file path (or null to disable)
transformTransformOptionsTransformation options (width, height, format, quality, fit)

string | null

function ImageThumbnail({ path }: { path: string }) {
const url = useStorageTransformUrl('images', path, {
width: 300,
height: 200,
format: 'webp',
quality: 85,
fit: 'cover'
});
return <img src={url || ''} alt="Thumbnail" />;
}