Beispiel #1
0
 public function executeShow(sfWebRequest $request)
 {
     $params = $this->getRoute()->getParameters();
     $image = new zsThumb($params);
     if (!$image->isCached()) {
         $image->cache();
     }
     $this->redirect($image->getWebPath());
 }
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     //$databaseManager = new sfDatabaseManager($this->configuration);
     //$connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true));
     $web_dir = sfConfig::get('sf_web_dir');
     $size = $arguments['size'];
     foreach ($arguments['path'] as $path) {
         $path = trim($path, '/');
         $files = sfFinder::type('file')->name('/\\.(jpg|jpeg|png|gif)/')->relative()->in($web_dir . DIRECTORY_SEPARATOR . $path);
         foreach ($files as $file) {
             $image = new zsThumb(array('path' => $path . DIRECTORY_SEPARATOR . $file, 'size' => $size));
             $image->cache();
             $this->logSection('file+', $image->getCachedPath());
         }
     }
 }