Exemplo n.º 1
0
/**
 * This file is part of the GLIZY framework.
 * Copyright (c) 2005-2012 Daniele Ugoletti <*****@*****.**>
 *
 * For the full copyright and license information, please view the COPYRIGHT.txt
 * file that was distributed with this source code.
 */
function getImage($applicationPath, $corePath = '')
{
    require_once $corePath . 'core/core.inc.php';
    org_glizy_Paths::init($applicationPath, $corePath);
    org_glizy_Config::init();
    $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : NULL;
    $w = isset($_REQUEST['w']) ? intval($_REQUEST['w']) : NULL;
    $h = isset($_REQUEST['h']) ? intval($_REQUEST['h']) : NULL;
    $force = isset($_REQUEST['f']) ? $_REQUEST['f'] == 'true' || $_REQUEST['f'] == '1' : false;
    $crop = isset($_REQUEST['c']) ? $_REQUEST['c'] == 'true' || $_REQUEST['c'] == '1' : false;
    if (is_null($id)) {
        exit;
    }
    glz_import('org.glizycms.mediaArchive.MediaManager');
    $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id);
    if ($media->type != 'IMAGE') {
        exit;
    }
    if (!is_null($w) && !is_null($h)) {
        //resize the image
        $mediaInfo = $media->getResizeImage($w, $h, $crop, 0, $force);
    } else {
        // get the full image
        $mediaInfo = $media->getImageInfo();
    }
    $ext = array(IMG_GIF => '.gif', IMG_JPG => '.jpeg', IMG_PNG => '.png', IMG_WBMP => '.wbmp');
    header("location: " . GLZ_HOST . '/' . $mediaInfo['fileName']);
}
Exemplo n.º 2
0
 function __construct($pathApplication = '', $pathCore = '', $configHost = '')
 {
     org_glizy_Paths::init($pathApplication, $pathCore);
     org_glizy_Paths::add('APPLICATION_TO_ADMIN', org_glizy_Paths::get('APPLICATION'));
     org_glizy_Paths::add('APPLICATION_TO_ADMIN_CACHE', org_glizy_Paths::get('APPLICATION') . '../cache/');
     parent::__construct($pathApplication, $pathCore, $configHost);
 }
Exemplo n.º 3
0
 function __construct($pathApplication = '', $pathCore = '', $pathApplicationToAdmin = '', $configHost = '')
 {
     $this->_pathApplicationToAdmin = $pathApplicationToAdmin;
     org_glizy_ObjectValues::set('org.glizy', 'admin', true);
     org_glizy_Paths::init($pathApplication, $pathCore);
     org_glizy_Paths::set('APPLICATION_MEDIA_ARCHIVE', $this->_pathApplicationToAdmin . 'mediaArchive/');
     // org_glizy_Paths::set('CACHE', $this->_pathCore.'../cache/');
     // org_glizy_Paths::set('CACHE_CODE', $this->_pathCore.'../cache/');
     // org_glizy_Paths::set('CACHE_IMAGES', $this->_pathCore.'../cache/');
     // org_glizy_Paths::set('STATIC_DIR', $this->_pathCore.'../static/');
     // org_glizy_Paths::set('CORE_STATIC_DIR', $this->_pathCore.'../static/org_glizy/');
     org_glizy_Paths::add('APPLICATION_TO_ADMIN', $this->_pathApplicationToAdmin);
     org_glizy_Paths::add('APPLICATION_TO_ADMIN_CACHE', $this->_pathApplicationToAdmin . '../cache/');
     org_glizy_Paths::add('APPLICATION_TO_ADMIN_PAGETYPE', $this->_pathApplicationToAdmin . 'pageTypes/');
     org_glizy_Paths::addClassSearchPath($this->_pathApplicationToAdmin . 'classes/');
     //if (org_glizy_Config::get('SESSION_PREFIX')=='') org_glizy_Config::set('SESSION_PREFIX', 'admin');
     parent::__construct($pathApplication, $pathCore, $configHost);
     $this->addEventListener(org_glizycms_contents_events_Menu::INVALIDATE_SITEMAP, $this);
 }
Exemplo n.º 4
0
<?php

$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : NULL;
$w = isset($_REQUEST['w']) ? intval($_REQUEST['w']) : 0;
if (is_null($id)) {
    exit;
}
if (!defined('GLZ_LOADED')) {
    require_once 'core/core.inc.php';
    org_glizy_Paths::init('application', '');
    org_glizy_Config::init();
    if (file_exists(org_glizy_Paths::get('APPLICATION_STARTUP'))) {
        // if the startup folder is defined all files are included
        glz_require_once_dir(org_glizy_Paths::get('APPLICATION_STARTUP'));
    }
    org_glizy_ObjectValues::set('org.glizy', 'languageId', 1);
}
$zoomFile = __Paths::get('CACHE') . '/zoom_' . $id . '_' . $w . '.xml';
if (!file_exists($zoomFile)) {
    glz_import('org.glizycms.mediaArchive.MediaManager');
    set_time_limit(0);
    $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id);
    if (preg_match('/\\.tif$/', $media->fileName)) {
        $mediaInfo = $media->getResizeImage(2000, 2000);
        $media->fileName = $mediaInfo['fileName'];
    }
    set_include_path(implode(PATH_SEPARATOR, array(realpath('application/libs/openzoom/'), get_include_path())));
    require 'Oz/Deepzoom/ImageCreator.php';
    $converter = new Oz_Deepzoom_ImageCreator(254, 1, "jpg", 0.8);
    $converter->create(realpath($media->getFileName()), $zoomFile);
}
Exemplo n.º 5
0
 function _init()
 {
     // inizializzazione delle classi
     // classe statica per la gestione dei path
     org_glizy_Paths::init($this->_pathApplication, $this->_pathCore);
     // legge i parametri di configurazione
     org_glizy_Config::init($this->_configHost);
     $sessionPrefix = org_glizy_Config::get('SESSION_PREFIX');
     if (empty($sessionPrefix)) {
         // se non è stato specificato un prefisso per la sessione
         // viene usato il nome dell'applicazione
         org_glizy_Config::set('SESSION_PREFIX', str_replace(array('.', ' ', '/'), '', $this->_pathApplication) . '_');
     }
     // inizializzazione della sessione
     __Session::start();
     if (org_glizy_config::get('LOG_FILE') != '') {
         if (org_glizy_config::get('LOG_FILE') != "firebug") {
             $this->_logObj = org_glizy_log_LogFactory::create('File', org_glizy_Paths::get('APPLICATION') . '/' . org_glizy_config::get('LOG_FILE'), array(), org_glizy_config::get('LOG_LEVEL'));
         } else {
             $this->_logObj = org_glizy_log_LogFactory::create('FireBug', array(), org_glizy_config::get('LOG_LEVEL'));
         }
         $this->log("Start application", GLZ_LOG_SYSTEM);
     }
     if (__Config::get('glizy.exception.log.format') == 'elasticsearch') {
         org_glizy_log_LogFactory::create('ElasticSearch', array(), 0);
         // Questo serve per poter istanziare la classe in Exception.php (gruppo 0 non logga nulla)
     }
     $this->login();
     $this->_initLanguage();
 }