code-challenge-image.php
PNG image renderer for the code-challenge. Uses PHP-GD with the vendored DejaVuSans Bold TTF and a few naive anti-OCR distortions (per-character rotation, two random lines, scattered noise pixels).
Table of Contents
Functions
- creationell_captcha_render_code_image() : string
- Renders a PNG of the given code and returns the raw bytes. Caller is responsible for emitting headers (`Content-Type: image/png`, `Cache-Control: no-store`) and the body.
Functions
creationell_captcha_render_code_image()
Renders a PNG of the given code and returns the raw bytes. Caller is responsible for emitting headers (`Content-Type: image/png`, `Cache-Control: no-store`) and the body.
creationell_captcha_render_code_image(string $code) : string
Falls back to GD's built-in bitmap font 5 if the vendored TTF is missing (logs a one-line warning so the operator sees the degradation).
Parameters
- $code : string
-
The code to render (4–8 chars expected; longer is trimmed implicitly by the width budget).