示例#1
0
/**
 * Genearte and send MIME header for the output image to client browser.
 *
 * @author cjiang
 */
function xhprof_generate_mime_header($type, $length)
{
    switch ($type) {
        case 'jpg':
            $mime = 'image/jpeg';
            break;
        case 'gif':
            $mime = 'image/gif';
            break;
        case 'png':
            $mime = 'image/png';
            break;
        case 'svg':
            $mime = 'image/svg+xml';
            // content type for scalable vector graphic
            break;
        case 'ps':
            $mime = 'application/postscript';
        default:
            $mime = false;
    }
    if ($mime) {
        xhprof_http_header('Content-type', $mime);
        xhprof_http_header('Content-length', (string) $length);
    }
}
示例#2
0
/**
 * Genearte and send MIME header for the output image to client browser.
 *
 * @author cjiang
 */
function xhprof_generate_mime_header($type, $length)
{
    switch ($type) {
        case 'jpg':
            $mime = 'image/jpeg';
            break;
        case 'gif':
            $mime = 'image/gif';
            break;
        case 'png':
            $mime = 'image/png';
            break;
        case 'ps':
            $mime = 'application/postscript';
        default:
            $mime = FALSE;
    }
    if ($mime) {
        xhprof_http_header('Content-type', $mime);
        xhprof_http_header('Content-length', (string) $length);
    }
}