Changeset 58

Show
Ignore:
Timestamp:
06/02/08 14:46:23 (2 years ago)
Author:
nperriault
Message:

Fixed application thumb upload and display

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/apps/main/modules/applications/actions/actions.class.php

    r57 r58  
    348348   * @param  Application           $application  The Application object instance 
    349349   */ 
    350   protected function processUploadedImage($file, Application &$application) 
     350  protected function processUploadedImage($file, Application $application) 
    351351  { 
    352352    if (is_null($file)) 
     
    354354      return null; 
    355355    } 
    356      
     356 
    357357    $thumb = ImagesTools::createThumb ( 
    358358      $file, 
    359359      sfConfig::get('sf_upload_dir').DIRECTORY_SEPARATOR.sfConfig::get('app_applications_upload_dir', 'applications'), 
    360       md5($application_data->getName()).'.jpg', 
     360      md5($application->getName()).'.jpg', 
    361361      sfConfig::get('app_applications_screenshot_width', 200), 
    362362      sfConfig::get('app_applications_screenshot_height', 140), 
     
    365365    ); 
    366366     
    367     $application->setScreenshotPath($thumb); 
     367    if ($thumb) 
     368    { 
     369      $application->setScreenshotPath($thumb); 
     370      $application->save(); 
     371    } 
    368372  } 
    369373 
  • trunk/config/ProjectConfiguration.class.php

    r54 r58  
    2222    } 
    2323  } 
     24   
     25  public function getWebDir() 
     26  { 
     27    return sfConfig::get('sf_web_dir'); 
     28  } 
     29   
     30  public function getUploadDir() 
     31  { 
     32    return sfConfig::get('sf_upload_dir'); 
     33  } 
     34   
     35  public function getUploadDirName() 
     36  { 
     37    $t = explode('/', sfConfig::get('sf_upload_dir')); 
     38    return (count($t) > 0) ? array_pop($t) : null; 
     39  } 
    2440} 
  • trunk/lib/model/Application.php

    r57 r58  
    122122      return sfConfig::get('app_applications_default_screenshot'); 
    123123    } 
     124    $t = explode('/', sfConfig::get('sf_upload_dir'));// FIXME: move this somewhere else 
     125    $base_dir = array_pop($t); 
    124126    return sprintf('/%s/%s/%s', 
    125                    sfConfig::get('sf_upload_dir_name')
     127                   $base_dir
    126128                   sfConfig::get('app_applications_upload_dir', 'applications'), 
    127129                   $this->getScreenshotPath());