Campos en el Formulario¶
$this->widgetSchema['image_1'] = new sfWidgetFormInputFileEditable(array(
'file_src' => '/'.basename(sfConfig::get('sf_upload_dir')).'/products/normal_'.$this->getObject()->getImage_1(),
'is_image' => true,
'edit_mode' => strlen($this->getObject()->getImage_1()) > 0,
'delete_label' => 'remover el archivo actual',
'template' => '<div>%file%<br />%input%</div>'
));
...
/* Validators */
$this->validatorSchema['image_1'] = new sfValidatorFileImage(array(
'required' => (! $this->getObject()->getImage_1()),
'max_size' => '5252880',
'path' => sfConfig::get('sf_upload_dir').'/products/original',
'mime_types' => 'web_images',
'min_width' => 470,
'max_width' => 99999,
'min_height' => 306,
'max_height' => 99999,
'validated_file_class' => 'sfResizedFile', // This class creates the thumbnails
), array(
'required' => 'Tenés que seleccionar una imagen principal.',
'max_size' => 'El tamaño máximo es 5 MB',
//'mime_types' => 'Sólo se permiten imágenes para web (jpg, png, gif)',
'invalid_image' => '%value% no es un archivo de imagen.',
'min_width' => 'El ancho de "%value%" es muy chico (mínimo %min_width% pixels).',
'min_height' => 'El alto de "%value%" es muy chico (mínimo %min_height% pixels).',
));
$this->validatorSchema['image_1_delete'] = new sfValidatorPass();
...
}