Example #1
0
File: view.php Project: jbyers/scry
//
$image_size = getimagesize($data['files'][$INDEX]['path']);
// FS READ
$file_size = filesize($data['files'][$INDEX]['path']);
// FS READ
// optionally fetch exifer data
//
if ($CFG_use_exifer) {
    include_once 'exif.php';
    $exif_data = read_exif_data_raw($data['files'][$INDEX]['path'], 0);
}
//////////////////////////////////////////////////////////////////////////////
// assign, display templates
//
$T['current'] =& $data['files'][$INDEX];
$T['current']['image_size'] =& $image_size;
$T['current']['view_size'] = calculate_resize($image_size[0], $image_size[1], $CFG_image_width, $CFG_image_height);
$T['current']['file_size'] = round($file_size / 1024, 0) . ' KB';
if ($CFG_use_exifer) {
    $T['current']['exif_data'] =& $exif_data;
}
$T['next'] =& $data['files'][$INDEX + 1];
$T['prev'] =& $data['files'][$INDEX - 1];
$T['path'] = path_list($IMAGE_DIR);
debug('T', $T);
include "{$CFG_path_template}/header.tpl";
// FS READ
include "{$CFG_path_template}/view.tpl";
// FS READ
include "{$CFG_path_template}/footer.tpl";
// FS READ
Example #2
0
if ('0' == $INDEX || $x == $image_props[0] && $y == $image_props[1]) {
    // show raw image via readfile or redirect
    //
    if ($CFG_images_outside_docroot) {
        header('Content-Type: image/jpeg');
        readfile("{$CFG_path_images}/{$IMAGE_DIR}/{$IMAGE_FILE}");
    } else {
        header("Location: {$CFG_url_images}{$IMAGE_DIR}/{$IMAGE_FILE}");
    }
    // if image outside docroot
    exit;
}
// if raw image display
// calculate resize, bounded by $INDEX resolution
//
list($resize_x, $resize_y) = calculate_resize($image_props[0], $image_props[1], $x, $y);
// if caching enabled and file exists, redirect
//
$cache = cache_test("{$IMAGE_DIR}/{$IMAGE_FILE}", $resize_x, $resize_y);
// FS SEE FUNCTION
if (!$CFG_debug_image) {
    // redirect to or load image inline if cache hit
    //
    if ($cache['is_cached']) {
        if ($CFG_cache_outside_docroot) {
            header('Content-Type: image/jpeg');
            readfile($cache['path']);
            // FS READ
            exit;
        } else {
            header('Location: ' . $cache['cache_url']);