Example #1
0
 function get_index()
 {
     $source = $this->in('source');
     if ($this->in('hash') !== static::hash($this->in())) {
         return E_DENIED;
     }
     $source = File::storage($source);
     $thumb = static::configure(\ThumbGen::make($source), $this->in());
     $regen = $this->in('regen', false);
     if ($regen and !$this->can('manager') and !$this->can('thumb.regen')) {
         $regen = false;
     }
     $url = $thumb->scaled($regen);
     if (!S::unprefix($url, $thumb->temp())) {
         throw new Exception("Cannot determine thumbnail URL from [{$url}].");
     }
     return Redirect::to(asset("thumbs/{$url}"));
 }