예제 #1
0
 /**
  * {@inheritDoc}
  * 
  * @return mixed
  */
 public function process()
 {
     $src = $this->getProperty('src');
     if (empty($src)) {
         return $this->failure();
     }
     $this->unsetProperty('src');
     $this->getSource($this->getProperty('source'));
     if (empty($this->source)) {
         $this->failure($this->modx->lexicon('source_err_nf'));
     }
     $src = $this->source->prepareSrcForThumb($src);
     if (empty($src)) {
         return '';
     }
     $this->loadPhpThumb();
     /* set source and generate thumbnail */
     $this->phpThumb->set($src);
     /* check to see if there's a cached file of this already */
     if ($this->phpThumb->checkForCachedFile()) {
         $this->phpThumb->loadCache();
         return '';
     }
     /* generate thumbnail */
     $this->phpThumb->generate();
     /* cache the thumbnail and output */
     $this->phpThumb->cache();
     $this->phpThumb->output();
     return '';
 }
예제 #2
0
            }
        }
    }
}

/* load phpThumb */
if (!$modx->loadClass('modPhpThumb',$modx->getOption('core_path').'model/phpthumb/',true,true)) {
    $modx->log(modX::LOG_LEVEL_ERROR,'Could not load modPhpThumb class.');
    return '';
}
$phpThumb = new modPhpThumb($modx,$scriptProperties);
/* do initial setup */
$phpThumb->initialize();
/* set source and generate thumbnail */
$phpThumb->set($src);

/* check to see if there's a cached file of this already */
if ($phpThumb->checkForCachedFile()) {
    $phpThumb->loadCache();
    return '';
}

/* generate thumbnail */
$phpThumb->generate();

/* cache the thumbnail and output */
$phpThumb->cache();
$phpThumb->output();

return '';