CodeIgniter 4 PHP
A PHP snippet for CodeIgniter 4 that answers requests for /pixel.gif with the empty GIF, decoded once at startup.
CodeIgniter 4 PHP
<?php
// app/Config/Routes.php
use CodeIgniter\Router\RouteCollection;
/** @var RouteCollection $routes */
$routes->get('/', 'Home::index');
$routes->get('/pixel.gif', static fn () => service('response')
->setContentType('image/gif', '')
->setHeader('Cache-Control', 'no-store')
->setBody(base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')));
We ran this snippet and compared the bytes it returned.
Check it
curl -sI http://localhost:8080/pixel.gif