Ejemplo n.º 1
0
 private function listContent()
 {
     $listSubFolder = $this->listSubFolder;
     $listFiles = $this->listFiles;
     $folderId = $this->request->arg[1];
     $page = empty($this->request->arg[2]) ? 1 : $this->request->arg[2];
     $limitNum = Config::get('default_file_pager');
     $startId = ($page - 1) * $limitNum;
     $this->data['limitNum'] = $limitNum;
     $this->data['page'] = $page;
     import('dao.Folder');
     $folder = new Folder();
     $myFolder = $folder->getFolder($folderId);
     if (empty($myFolder)) {
         goToUrl('/pageNotFound');
     }
     $this->data['currentFolderId'] = $myFolder['fd_id'];
     if ($listSubFolder) {
         $options = array('limit' => $limitNum, 'start' => $startId);
         $subFolders = $folder->getSubFolder($myFolder['fd_id'], $options);
         foreach ($subFolders as $key => $subFolder) {
             $defaultCoverThumb = Config::get('default_cover_thumbnail');
             $defaultCoverThumb = empty($defaultCoverThumb) ? '/images/default_cover_thumbnail.jpg' : $defaultCoverThumb;
             $folderCover = $folder->getFolderCover($subFolder['fd_id']);
             $coverThumb = imageCache::cacheImage($folderCover, 160, 120);
             $subFolder['thumbnail'] = $coverThumb ? $coverThumb : $defaultCoverThumb;
             $subFolder['filesNum'] = count($folder->getFilesInFolder($subFolder['fd_id'], array("where" => "and image_type>0")));
             $subFolder['subFoldersNum'] = count($folder->getSubFolder($subFolder['fd_id']));
             $subFolders[$key] = $subFolder;
         }
         $this->data['folders'] = $subFolders;
         $this->data['subFolderTotal'] = $folder->getSubFolderTotal($folderId);
         if ($listFiles && count($this->data['subFolderTotal']) > $limitNum) {
             $this->data['subFolderPager'] = 'more';
         } else {
             $this->data['subFolderPager'] = 'full';
         }
     }
     if ($listFiles) {
         $options = array("where" => "and image_type>0", "limit" => $limitNum, 'start' => $startId);
         $myFiles = $folder->getFilesInFolder($folderId, $options);
         foreach ($myFiles as $key => $myFile) {
             $defaultThumb = Config::get('default_thumbnail');
             $defaultThumb = empty($defaultThumb) ? '/images/default_thumbnail.jpg' : $defaultThumb;
             $myThumb = imageCache::cacheImage($myFile['path'], 160, 120);
             $myFile['thumbnail'] = $myThumb ? $myThumb : $defaultThumb;
             $myFiles[$key] = $myFile;
         }
         //ZDebug::my_print($myFiles, 'files');
         $this->data['files'] = $myFiles;
         $this->data['filesTotal'] = $folder->getFilesInFolderTotal($folderId);
         if ($listSubFolder && count($this->data['filesTotal']) > $limitNum) {
             $this->data['filesPager'] = 'more';
         } else {
             $this->data['filesPager'] = 'full';
         }
     }
     $this->data['currentFolderName'] = $myFolder['name'];
     $this->data['nav'] = $this->genNav($myFolder, $folder);
 }
Ejemplo n.º 2
0
 public static function init()
 {
     $imageCachePathRelative = Config::get('image_cache_path');
     $imageCachePathRelative = empty($imageCachePathRelative) ? 'image_cache' : $imageCachePathRelative;
     self::$imageCachePath = DOC_ROOT . $imageCachePathRelative . DIRECTORY_SEPARATOR;
     self::$imageCacheUrl = '/' . $imageCachePathRelative . '/';
 }
Ejemplo n.º 3
0
 public function getSameFilesPrevAjax()
 {
     $fd_id = $this->request->arg[2];
     $fid = $this->request->arg[3];
     $sameFiles = $this->getSameFilesPrev($fd_id, $fid, 10, TRUE);
     for ($i = 0; $i < count($sameFiles); $i++) {
         $sameFiles[$i]['thumbnail'] = imageCache::cacheImage($sameFiles[$i]['path'], 120, 90);
     }
     veetreeJson($sameFiles);
 }
Ejemplo n.º 4
0
} elseif ($_SERVER['argc'] == 3) {
    $start_fid = trim($_SERVER['argv'][1]);
    $end_fid = trim($_SERVER['argv'][2]);
} else {
    show_error();
}
function show_error()
{
    global $enclose;
    echo "Wrong Parameter! " . $enclose;
    echo "Usage via command line: " . $enclose;
    echo "  ---- buildThumbnails.php <start_fid> <end_fid>" . $enclose;
    echo "Usage via browser: " . $enclose;
    echo "  ---- http://foo.com/buildThumbnails.php?start_fid=123&end_fid=12345" . $enclose;
    exit;
}
include_once '../bootstrap.inc';
set_time_limit(0);
$files = array();
$files = DB::$dbInstance->getRows('SELECT * FROM `files` where image_type>0 and fid>' . $start_fid . ' and fid<' . $end_fid);
foreach ($files as $file) {
    $fileFullName = $file['path'];
    $myThumb = imageCache::cacheImage($fileFullName, 160, 120, TRUE);
    if (!$myThumb) {
        ZDebug::my_echo('error build thumbnail for ' . $fileFullName);
    }
    $myThumb = imageCache::cacheImage($fileFullName, 120, 90, TRUE);
    if (!$myThumb) {
        ZDebug::my_echo('error build thumbnail for ' . $fileFullName);
    }
}