Welcome Guest, Not a member yet? Register   Sign In
Help with Output image
#21

[eluser]d1a8lo24[/eluser]
Try the following, you can change the headers with CIs header output.

Code:
class Yourimage extends Controller {
    
    function index()
    {
        // Path to file
        $file = './path/to/image';
                    
        if (file_exists($file)) {
        header('Content-Type: image/jpeg');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file));
        ob_clean();
        flush();
        readfile($file);
        exit;
        } else {
                  echo 'No Image';
                }    
    }
}

If something doesn't work remove a header.
#22

[eluser]SoulM4n[/eluser]
[quote author="d1a8lo24" date="1304724605"]Try the following, you can change the headers with CIs header output.

Code:
class Yourimage extends Controller {
    
    function index()
    {
        // Path to file
        $file = './path/to/image';
                    
        if (file_exists($file)) {
        header('Content-Type: image/jpeg');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file));
        ob_clean();
        flush();
        readfile($file);
        exit;
        } else {
                  echo 'No Image';
                }    
    }
}

If something doesn't work remove a header.[/quote]

Awww ... finally i got it working.
Thank you so much d1a8lo24 and thanks also Toopay for his kindness :)




Theme © iAndrew 2016 - Forum software by © MyBB