daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jul 22nd, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class PhotoForm extends BasePhotoForm
  2. {
  3.   public function configure()
  4.   {
  5.     unset($this['product_id'] ,$this['width'], $this['height']);
  6.    
  7.     $this->widgetSchema['filename'] = new sfWidgetFormInputFileEditable(array(
  8.     'file_src'    => '/uploads/products/photos/'.$this->getObject()->filename,
  9.     'edit_mode'   => !$this->isNew(),
  10.     'is_image'    => true,
  11.     'with_delete' => true,
  12.     ));
  13.    
  14.     $this->validatorSchema['filename'] = new sfValidatorFile(array(
  15.     'mime_types' => 'web_images',
  16.     'path' => sfConfig::get('sf_upload_dir').'/products/photos',
  17.     'required' => false,
  18.     ));
  19.    
  20.     $this->validatorSchema['filename_delete'] = new sfValidatorBoolean();
  21.   }
  22.  
  23.   protected function saveFile($field, $filename = null, sfValidatedFile $file = null)
  24.   {
  25.     if (null === $file)
  26.     {
  27.       $file = $this->getValue($field);
  28.     }
  29.    
  30.     $filename = $this->getUniqueFilename($this->getObject()->Product->getName() . $file->getExtension($file->getOriginalExtension()));
  31.    
  32.     $savedname  = parent::saveFile($field, $filename, $file);
  33.     return $this->createThumbNail($field , $savedname);
  34.   }
  35.  
  36.   protected function removeFile($field)
  37.  
  38.  
  39.   protected function createThumbnail($field , $savedname)
  40.  
  41.  
  42.   protected function deleteThumbnail($field)
  43.  
  44.  
  45.   protected function generateThumbname($name)
  46.  
  47.  
  48.   protected function getUniqueFilename($name)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top