Skip to content
Keenpix docs
Frameworks

Plain HTML & any backend

No framework required — build the URL anywhere.

Because Keenpix is just a URL, it works with no framework at all — and with any server-side language (PHP, Ruby, Python, Go, …). Build the URL and render an <img>.

Static HTML

<img
  src="https://keenpix.example.com/img/https://cdn.example.com/hero.jpg?project=YOUR_ID&w=1280"
  sizes="100vw"
  loading="lazy"
  decoding="async"
  alt="Hero"
/>

With no fmt parameter, Keenpix negotiates the output from the browser's Accept header. Add fmt=avif, fmt=webp, fmt=jpeg, fmt=png, or fmt=svg only when you want to force one format.

fmt=svg is explicit SVG delivery. If the source is SVG and fmt is omitted or set to auto, Keenpix returns a negotiated raster format instead.

Responsive with srcset

<img
  src="https://keenpix.example.com/img/https://cdn.example.com/hero.jpg?project=YOUR_ID&w=1280&fmt=auto"
  srcset="
    https://keenpix.example.com/img/https://cdn.example.com/hero.jpg?project=YOUR_ID&w=640&fmt=auto   640w,
    https://keenpix.example.com/img/https://cdn.example.com/hero.jpg?project=YOUR_ID&w=1280&fmt=auto 1280w,
    https://keenpix.example.com/img/https://cdn.example.com/hero.jpg?project=YOUR_ID&w=1920&fmt=auto 1920w
  "
  sizes="100vw"
  alt="Hero"
/>

Server-side (example: PHP)

<?php
function keenpix(string $src, int $w): string {
  $q = http_build_query(['project' => 'YOUR_ID', 'w' => $w, 'fmt' => 'auto']);
  return "https://keenpix.example.com/img/" . rawurlencode($src) . "?$q";
}
?>
<img src="<?= keenpix('https://cdn.example.com/hero.jpg', 1280) ?>" alt="Hero" />

The same one-liner works in Rails, Django, Laravel, or a CMS template — just URL-encode source URLs that contain their own query string or fragment.

On this page