Example #1
0
function getThumbnail($path, $width, $height)
{
    if (!$path) {
        return '';
    }
    \cf\Image::$USE_IMAGEMAGICK = \cf\Config::use_imagemagick;
    $thumb = new \cf\Thumbnail($_SERVER['DOCUMENT_ROOT'] . '/' . $path, $width, $height);
    return $thumb->url();
}
Example #2
0
<?php

header('Content-type: text/html; charset=utf-8');
require_once dirname(__FILE__) . '/../config.php';
require_once cf\Config::path . 'param.php';
require_once cf\Config::path . 'user.php';
require_once cf\Config::path . 'image.php';
require_once cf\Config::path . 'api/session.php';
require_once cf\Config::path . 'api/admin.php';
if (cf\Config::use_imagemagick) {
    cf\Image::$USE_IMAGEMAGICK = true;
}
function forward($url)
{
    session_write_close();
    header("Location: {$url}");
    exit;
}
$user = cf\User::getLoggedIn();
if (!$user && !defined('NO_AUTH')) {
    forward('login.php');
}
if (!defined('SMARTY_DIR')) {
    define('SMARTY_DIR', cf\Config::smarty_dir);
}
require_once SMARTY_DIR . 'Smarty.class.php';
$smarty = new Smarty();
$smarty->compile_check = true;
$smarty->debugging = false;
$smarty->addPluginsDir(cf\Config::path . 'components/');
$root_url = substr($_SERVER['REQUEST_URI'], 0, stripos($_SERVER['REQUEST_URI'], 'admin') + 6);