# Host images and video for your website

Put product photos, blog images, videos, audio and PDFs on a fast, stable
public address, resized and converted to WebP for each screen. Culacc makes
the responsive HTML for you. Storage and delivery are in the EU.

## Publish a file

```js
const { Culacc } = require('@culacc/sdk');
const culacc = new Culacc({ key: process.env.CULACC_KEY });   // files:write and links:write

const file = await culacc.upload(buffer, { name: 'hero.jpg', path: '/Site' });
const { link, html } = await culacc.files.publish(file.id);

link.url   // https://media.culacc.com/aB3…/hero.jpg
html       // <picture> with WebP srcset, width, height and lazy loading
```

Nothing is public until you publish it, and switching a link off stops it at
once.

## Resize on the way out

Add parameters to any published image address:

```
https://media.culacc.com/aB3…/hero.jpg?w=800&format=webp
```

| Parameter | Meaning |
|---|---|
| `w`, `h` | width and height in pixels |
| `format` | `webp`, `jpeg`, `png`, or `auto` for whatever the browser prefers |
| `q` | quality, 1 to 100 |
| `fit` | `cover`, `contain` or `inside` |

```js
culacc.image(link.url, { width: 800, format: 'webp' })
```

Versioned addresses are cached for a year. Videos stream with range requests,
so seeking works, and get a poster frame.

## Keep other sites from embedding your files

```js
await culacc.files.publish(file.id, { allowedHosts: ['your-site.com'] });
await culacc.files.update(file.id, { status: 'off' });     // switch off
await culacc.files.unpublish(file.id);                     // remove for good
```

## Costs and limits

- Traffic: 10 GB a month free, then €1 per TB, counted to the cent and added to your Culacc invoice.
- A monthly spending limit you set: published files stop loading at it, and nothing is deleted.
- Storage at your Culacc price (5 GB free, then €0.50 per 100 GB a month).

## Also

- WordPress: the Culacc plugin in the WordPress.org directory.
- Webflow and Figma: place Culacc files straight into your designs.
- Let visitors edit what you host: [Add an Edit button](/developers/edit-button/).

## Reference

- [Publishing](/developers#publishing) and [Images on the way out](/developers#images-on-the-way-out) in the API reference
