Table of Contents
Working with Images
Images in Val
Val provides a type-safe way to handle images with built-in support for local and remote images. Images are optimized and integrated with Next.js Image component.
Defining Image Schema
Use `s.image()` to define an image field in your schema:
Using Local Images
Local images are stored in the `/public/val` folder. Use `c.image()` to reference them:
Using Remote Images
Enable remote images by adding `.remote()` to your schema. Then use `c.remote()` to reference external URLs:
Rendering Images
Use the `ValImage` component to render images in your React components:
Image Properties
When defining images, you must provide:
width: The intrinsic width of the image
height: The intrinsic height of the image
alt: Alt text for accessibility
mimeType: (Remote images only) The MIME type
Important
Local images must be stored in the `/public/val` directory. Val Studio will automatically upload images to this location when you add them through the editor.