Listing 15.1. Akcja show modułu img
<?php

class Actions extends ActionsBase
{
    public function execute_show()
    {
        if (
            isset($_GET['slug']) &&
            str_ivslug($_GET['slug']) &&
            ($img = ImgPeer::retrieveBySlug($_GET['slug']))
        ) {
            $this->noLayout();
            header('Content-Type: image/png');
            echo stream_get_contents($img->getImage());
        } else {
            $this->execute_404();
        }
    }
}
