README.md

# ImgproxyUrl

[![Hex.pm](https://img.shields.io/hexpm/v/imgproxy_url.svg)](https://hex.pm/packages/imgproxy_url)
[![Docs](https://img.shields.io/badge/docs-hexdocs-blue.svg)](https://hexdocs.pm/imgproxy_url)

Signed imgproxy URL generator with HMAC-SHA256 for Elixir. Zero external dependencies.

> Built by [Shiko](https://shiko.vet) — tech@shiko.vet

## Installation

```elixir
{:imgproxy_url, "~> 0.1"}
```

## Configuration

```elixir
config :imgproxy_url,
  host: "https://img.example.com",
  key: "your_hex_encoded_key",
  salt: "your_hex_encoded_salt"
```

## Usage

```elixir
# Basic resize
ImgproxyUrl.build("s3://bucket/photo.jpg", width: 200, height: 200)
# => "https://img.example.com/<signature>/rs:fit:200:200/q:80/<encoded>.webp"

# Custom quality and resize
ImgproxyUrl.build("s3://bucket/photo.jpg", width: 600, height: 600, quality: 90, resize: "fill")

# Plain URL encoding (human-readable source)
ImgproxyUrl.build_plain("s3://bucket/photo.jpg", width: 200, height: 200)
# => "https://img.example.com/<signature>/rs:fit:200:200/q:80/plain/s3://bucket/photo.jpg@webp"

# Override config per-call
ImgproxyUrl.build("s3://other/img.png", width: 100, height: 100, host: "https://other.img.com", key: "...", salt: "...")
```

## Presets Pattern

```elixir
defmodule MyApp.ImagePresets do
  def thumbnail(path), do: ImgproxyUrl.build(path, width: 200, height: 200, quality: 75)
  def medium(path), do: ImgproxyUrl.build(path, width: 600, height: 600, quality: 80)
  def large(path), do: ImgproxyUrl.build(path, width: 1200, height: 1200, quality: 85)
end
```

## Links

- [imgproxy](https://imgproxy.net)
- [shiko.vet](https://shiko.vet)

## License

MIT