public static function output($image, $type)
    {
        $parts = explode('/', $type);
        $func = 'image'.strtolower($parts[1]);
        if (!function_exists($func)) {
            return;
        }

        $args = null;

        switch ($parts[1]) {
            case 'jpeg':
                $args = array($image, null, 100);
                break;
            case 'png':
                $args = array($image, null, 9);
                break;
            case 'gif':
                $args = array($image, null);
                break;
            default:
                return;
        }
        ob_start();
        call_user_func_array($func, $args);
        $image = ob_get_clean();

        return $image;
    }
public static function output($image, $type)
    {
        $parts = explode('/', $type);
        $func = 'image'.strtolower($parts[1]);
        if (!function_exists($func)) {
            return;
        }

        $args = null;

        switch ($parts[1]) {
            case 'jpeg':
                $args = array($image, null, 100);
                break;
            case 'png':
                $args = array($image, null, 9);
                break;
            case 'gif':
                $args = array($image, null);
                break;
            default:
                return;
        }
        ob_start();
        call_user_func_array($func, $args);
        $image = ob_get_clean();

        return $image;
    }
public static function output ( $ image , $ type ) { $ parts = explode ( '/' , $ type ) ; $ func = 'image' . strtolower ( $ parts [ 1 ] ) ; if ( ! function_exists ( $ func ) ) { return ; } $ args = null ; switch ( $ parts [ 1 ] ) { case 'jpeg' : $ args = array ( $ image , null , 100 ) ; break ; case 'png' : $ args = array ( $ image , null , 9 ) ; break ; case 'gif' : $ args = array ( $ image , null ) ; break ; default : return ; } ob_start ( ) ; call_user_func_array ( $ func , $ args ) ; $ image = ob_get_clean ( ) ; return $ image ; }
Outputs an image to the desired image type.

@param  resource $image The image resource
@param  string   $type  The image mimetype

@return string
Outputs an image to the desired image type .