@stattic/image
v0.0.10
Published
Helpers for generating WordPress.com Site Accelerator image URLs.
Readme
@stattic/image
Small helpers for generating WordPress.com Site Accelerator image URLs.
Use this package when a Stattic space or integration needs predictable image resizing and optimization URLs without hand-building query strings.
Install
npm install @stattic/imageUsage
import { siteAcceleratorUrl } from "@stattic/image";
const src = siteAcceleratorUrl("https://example.com/photo.jpg", {
w: 1200,
quality: 80,
strip: "all",
});Absolute http and https URLs are rewritten through the Site Accelerator
host. Relative paths are returned unchanged, so the helper is safe to call with
mixed local and remote image sources.
Next.js Helpers
import { statticImageLoader } from "@stattic/image/next-loader";The Next.js exports are thin adapters around the same URL builder.
