Jelmer Schreuder wrote on 02/11/11 2:26 pm:If it's loadable by the autoloader it can be used as a controller. Thus must be in global namespace and registered in bootstrap.php. It is bad-practice though, packages are functional additions to Fuel - not front-end. If you need a controller it might be better for it to be a module.
... code of generation image captcha ... header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); if(function_exists('imagejpeg')) { header('Content-Type: image/jpeg'); imagejpeg($img2, null, static::$jpeg_quality); } else if(function_exists('imagegif')) { header('Content-Type: image/gif'); imagegif($img2); } else if(function_exists('imagepng')) { header('Content-Type: image/x-png'); imagepng($img2); }
\Output::set_header('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT'); // note that it's the name and value, no colon and 2 values
Jelmer Schreuder wrote on 02/11/11 2:47 pm:As I said, I think it should be a module instead of a package if you want it routable. But in this case I'd suggest to just create a function that one can put in any controller method and does all this. One other pointer, we have an output class with a method for using HTTP headers:\Output::set_header('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT'); // note that it's the name and value, no colon and 2 values
Edit: nevermind what I said about core namespaces earlier, I forgot we optimized that long ago.
void header ( string $string [, [b]bool $replace = true[/b] [, int $http_response_code ]] )In Fuel it always sets to true. In my code I use false to stop cache image in MSIE.
It looks like you're new here. If you want to get involved, click one of these buttons!