Skip to content
CafeJS Docs

Images

Images uploaded in the admin go to public/uploads/. Each one needs a description for screen readers, a clear source, and smaller copies for phones.

Upload an image

  1. Click the image field in a section and choose a file from your computer.
  2. Fill in Image description (alt text): one sentence saying what the image shows. Leave it empty for a purely decorative image.
  3. Press Lưu (Save).

The image is saved to public/uploads/ and referenced as /uploads/….

Smaller copies for phones

After adding images, run this in the template’s folder (or ask a developer to):

Terminal
pnpm images --recompress

It recompresses each original (at most 1600 px wide) and writes 480, 800 and 1200 px copies to public/variants/. Without it the images still show, but phones download the large ones.

Note

Live with TinaCloud: images uploaded in the admin are committed to public/uploads/ and show after the build. Their phone copies don’t exist until someone runs pnpm images --recompress locally and commits.

Source and licence

New images need a clear source and licence; record them in CREDITS.md (source, author, licence). The engine’s sample photos are in public/samples/.

Warning

The preview admin saves nothing, uploaded images included.