### WordPress plugin setup steps Source: https://smallpict.app Steps to install and configure the smallPict WordPress plugin: search for 'smallPict' in Plugins → Add New, activate it, paste your API key (sp_wp_xxxxxxxx) in Settings → smallPict, and run the Bulk Optimizer for existing images. ```text 1 Plugins → Add New: search "smallPict", install and activate 2 Settings → smallPict: paste your API key sp_wp_xxxxxxxx 3 New uploads are optimized automatically 4 Existing images: run the Bulk Optimizer in the plugin ``` -------------------------------- ### REST API curl request to /v1/optimize Source: https://smallpict.app Sends a POST request to https://api.smallpict.app/v1/optimize with an image file. Requires an API key and a signature (SIG) computed as hex(HMAC-SHA256(secret, "POST\n/v1/optimize\n$TS\n$BODY_SHA256")). The example uses environment variables for the API key and timestamp. ```bash # SIG = hex(HMAC-SHA256(secret, "POST\n/v1/optimize\n$TS\n$BODY_SHA256")) curl -X POST https://api.smallpict.app/v1/optimize \ -H "X-API-Key: $SMALLPICT_API_KEY" \ -H "X-Timestamp: $TS" -H "X-Signature: $SIG" \ -H "Content-Type: application/json" \ -d '{"filename":"header.jpg","mime_type":"image/jpeg", "filesize":184320,"options":{"format":"webp"}}' ``` -------------------------------- ### Node.js SDK usage with @smallpict/sdk Source: https://smallpict.app Uses the @smallpict/sdk package to optimize an image. The SDK signs every request automatically. Requires SMALLPICT_API_KEY and SMALLPICT_SECRET_KEY environment variables. Reads 'header.jpg' and outputs the optimized URL and savings percentage. ```javascript // npm install @smallpict/sdk (signs every request for you) import { SmallPict } from "@smallpict/sdk"; import fs from "node:fs"; const sp = new SmallPict({ apiKey: process.env.SMALLPICT_API_KEY, secretKey: process.env.SMALLPICT_SECRET_KEY, }); const out = await sp.optimize(fs.readFileSync("header.jpg"), { format: "webp" }); console.log(out.url, out.savingsPercentage); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.