private function _viewSourceById($id)
 {
     $imageModel = new Model_Image();
     $imageRow = $imageModel->fetchRow($imageModel->getAdapter()->quoteInto("id = ?", $id));
     if (count($imageRow) && isset($imageRow->filename)) {
         $file = new Garp_File('image');
         $url = $file->getUrl($imageRow->filename);
         header("Location: " . $url);
         // @codingStandardsIgnoreStart
         exit;
         // @codingStandardsIgnoreEnd
     }
     throw new Zend_Controller_Action_Exception("Sorry, I can't find the requested image.", 404);
 }
Beispiel #2
0
 /**
  * Generate scaled versions of a specific source file, along all configured templates.
  *
  * @param String $filename Filename of the source file in need of scaling
  * @param Boolean $overwrite
  * @return Void
  */
 protected function _generateScaledImagesForFilename($filename, $overwrite = false)
 {
     Garp_Cli::lineOut('Generating scaled images for file "' . $filename . '".');
     if (!$filename) {
         return;
     }
     $scaler = new Garp_Image_Scaler();
     $templates = $scaler->getTemplateNames();
     $imageModel = new Model_Image();
     $select = $imageModel->getAdapter()->quoteInto('filename = ?', $filename);
     $record = $imageModel->fetchRow($select);
     $file = new Garp_Image_File();
     $success = 0;
     if (!$record) {
         Garp_Cli::errorOut('I couldn\'t find any records in the database, containing "' . $filename . '" as filename');
         return;
     }
     foreach ($templates as $template) {
         $success += (int) $this->_scaleDatabaseImage($record, $file, $scaler, $template, $overwrite);
     }
     return $success == count($templates);
 }