Ejemplo n.º 1
0
function imageHandler($sourcefile, $savename, $savedir, $widthmax, $heightmax, $quality, $extension)
{
    $destfile = $savedir . "/" . $savename;
    if (file_exists($destfile)) {
        unlink($destfile);
    }
    if (file_exists($sourcefile)) {
        preg_match('/\\.(jpg|png|gif)$/', $sourcefile, $ext);
        $image = new img($sourcefile, $ext[1]);
        //echo $widthmax.'/'.$heightmax;exit();
        $image->resize($widthmax, $heightmax, true);
        $image->store($destfile);
        chmod($destfile, 0777);
    }
}
Ejemplo n.º 2
0
if (preg_match(RESIZE, $request_uri, $i)) {
    // get image name
    $filename = DIR_IMG_MAIN . $i[2] . $i[6];
    // keep aspect ratio
    $keep = !empty($i[5]) ? false : true;
    $image = new img($filename, $i[7]);
    $image->resize($i[3], $i[4], !empty($i[5]) ? false : true);
    $image->store(DIR_RESIZED . $i[0]);
    $image->show();
    unset($image);
} elseif (preg_match(WATERMARK, $request_uri, $i)) {
    // get image name
    $filename = DIR_CUR . 'images' . DIR_SEP . $i[2] . '.jpg';
    $image = new img($filename);
    $image->watermark(DIR_CUR . 'images' . DIR_SEP . 'config' . DIR_SEP . 'watermark.png', 10, 10);
    $image->store(DIR_WM . $i[0]);
    $image->show();
    unset($image);
} elseif (preg_match('/\\/([^\\/]+).html$/i', $request_uri, $i)) {
    $parsed =& $i[1];
    header("HTTP/1.0 200 OK");
    require_once DIR_CUR . 'index.php';
} elseif (preg_match('/error.tester$/i', $request_uri)) {
    header("HTTP/1.0 200 OK");
    echo 'ok';
    exit;
} else {
    header("HTTP/1.0 404 Not Found");
    ?>
    <html><head><title>Document Not Found</title></head>
    <body><h1>Document Not found</h1>