Skip to content
Image docs0.3

Ktor Integration

Latest stable Based on Image release 0.3.0

bluetape4k-images-ktor supplies focused route helpers for thumbnails and CAPTCHA. It depends on the core image and CAPTCHA modules and the shared Bluetape Ktor foundation.

ImageThumbnailKtorRoutes connects an input image source to resizing and encoded output. The application must define where media comes from, which dimensions and formats are allowed, cache behavior, authentication, and request limits. Never let a route resolve arbitrary filesystem paths from a request.

CaptchaKtorRoutes issues challenge images and verifies answers through the CAPTCHA service. Route configuration controls API shape, while the challenge store owns one-shot state and expiry. Install JSON serialization and error handling in the application; the helper does not silently alter the global Ktor pipeline.

The Ktor image API workshop demonstrates both route families with tests. Use it as the smallest complete topology, then replace in-memory or example components with application-owned storage, authentication, rate limits, and observability.

OCR is not hidden inside the route module. The Ktor OCR workshop shows how to combine multipart input, the framework-neutral OCR engine, response models, and failures explicitly.