示例#1
0
                    if (empty($params['w'])) {
                        $mode = IMAGE_EDITOR_RESIZE_HEIGHT;
                    } else {
                        if (empty($params['h'])) {
                            $mode = IMAGE_EDITOR_RESIZE_WIDTH;
                        } else {
                            $mode = empty($p['m']) ? IMAGE_EDITOR_RESIZE_PROPORTIONAL : $p['m'];
                        }
                    }
                    $thumb_width = (int) empty($params['w']) ? $params['h'] : $params['w'];
                    $thumb_height = (int) empty($params['h']) ? $params['w'] : $params['h'];
                    $IE->resize($thumb_width, $thumb_height, $mode);
                    break;
            }
            if (!empty($params['f']) && $params['f'] === 'gs') {
                $IE->grayscale();
            }
            $IE->commit();
        }
        $file_name = $cache_name;
    }
}
$last_modified = filemtime($file_name);
if (!empty($file_name) && !empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $last_modified <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
    header('HTTP/1.0 304 Not Modified');
} else {
    if (!empty($file_name)) {
        $size = getimagesize($file_name);
        header("Content-type: {$size['mime']}");
        header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $last_modified) . ' GMT');
        readfile($file_name);