public function thumb($path, $windth, $height)
 {
     $expire = 3600 * 24;
     $requestTime = $_SERVER['REQUEST_TIME'];
     $lastModified = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : 0;
     if ($lastModified && $requestTime <= $lastModified + $expire) {
         header('HTTP/1.1 304 Not Modified', true);
         $responseTime = $lastModified;
         $exit = true;
     } else {
         $responseTime = $requestTime;
         $exit = false;
     }
     header('Cache-Control: max-age=' . $expire);
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $responseTime) . ' GMT');
     header('Expires: ' . gmdate('D, d M Y H:i:s', $responseTime + $expire) . ' GMT');
     if ($exit) {
         exit;
     }
     include CORE_ROOT . 'Thumb.class.php';
     $path = $this->get_gpath($path);
     if (!is_readable($path)) {
         $path = DATA_PATH . 'tmp/nothumb.jpg';
     }
     $Thumb = new Thumb();
     $Thumb->create($path, $windth, $height);
     $Thumb->show();
 }
Ejemplo n.º 2
0
if (!file_exists('../config/config.yml')) {
    echo "NO EXISTE EL FICHERO DE CONFIGURACION";
    exit;
}
if (file_exists("../bin/yaml/lib/sfYaml.php")) {
    include "../bin/yaml/lib/sfYaml.php";
} else {
    echo "NO EXISTE LA CLASE PARA LEER ARCHIVOS YAML";
    exit;
}
// ---------------------------------------------------------------
// CARGO LOS PARAMETROS DE CONFIGURACION.
// ---------------------------------------------------------------
$config = sfYaml::load('../config/config.yml');
$app = $config['config']['app'];
// ---------------------------------------------------------------
// ACTIVAR EL AUTOLOADER DE CLASES Y FICHEROS A INCLUIR
// ---------------------------------------------------------------
define("APP_PATH", $_SERVER['DOCUMENT_ROOT'] . $app['path'] . "/");
include_once "../" . $app['framework'] . "Autoloader.class.php";
Autoloader::setCacheFilePath(APP_PATH . 'tmp/class_path_cache.txt');
Autoloader::excludeFolderNamesMatchingRegex('/^CVS|\\..*$/');
Autoloader::setClassPaths(array('../' . $app['framework'], '../entities/', '../lib/'));
spl_autoload_register(array('Autoloader', 'loadClass'));
$fileName = "../docs/docs" . $_SESSION['emp'] . "/catalog/" . $_GET['img'];
if (file_exists($fileName)) {
    $thumb = new Thumb();
    $thumb->loadImage($fileName);
    $thumb->resize($_GET['w'], 'width');
    $thumb->show();
}