CodeIgniter Forums
image processor and sessions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: image processor and sessions (/thread-45801.html)



image processor and sessions - El Forum - 10-06-2011

[eluser]quasiperfect[/eluser]
hi

i have a controller that manages all my images
the idea is that i want to show some images based on session variables

i call the controller in my html like this
Code:
<img src="http://site/image_processor/parameter/parameter/">

my controller logic is like this
make some verifications if user is ok then show image like this
Code:
$im = @imagecreatefromjpeg($image);
if(!$im)
{
   $this->_img_error($errorcode);
}
else
{
    header("Content-type: image/jpg");
    imagejpeg($im);
    imagedestroy($im);
}
the function _img_error generates a image with a text containing the error so i always output a image

the problem is that i get a lot of errors in my logs because the headers are already sent
when the session lib sets the cookie

any idea on how to solve this ?