コード例 #1
0
ファイル: thumb.php プロジェクト: Lazary/webasyst
        foreach ($size as &$s) {
            $s *= 2;
        }
        unset($s);
        $size = implode('x', $size);
    }
}
wa()->getStorage()->close();
$original_path = $protected_path . $file;
$thumb_path = $public_path . $request_file;
if ($file && file_exists($original_path) && !file_exists($thumb_path)) {
    $thumbs_dir = dirname($thumb_path);
    if (!file_exists($thumbs_dir)) {
        waFiles::create($thumbs_dir);
    }
    $max_size = $app_config->getOption('image_max_size');
    if ($max_size && $enable_2x) {
        $max_size *= 2;
    }
    $image = shopImage::generateThumb($original_path, $size, $max_size);
    if ($image) {
        $image->save($thumb_path, $app_config->getSaveQuality($enable_2x));
        clearstatcache();
    }
}
if ($file && file_exists($thumb_path)) {
    waFiles::readFile($thumb_path);
} else {
    header("HTTP/1.0 404 Not Found");
    exit;
}