Make it simpler - do it directly inside of forms you embed.

/**
 * Read my comments.
 */
class ImageForm extends BaseImageForm
{
  // configure() your form

  /**
   * This is hook used by Doctrine (and think Propel as well) form to modify
   * cleaned up (validated) values.
   *
   * This is simple example - make research on your own to understand it
more.
   *
   * Create method name after *update%column_name%Column()* where
%column_name%
   * is camelized column name where you store image filepath.
   */
  protected function updateImageFilepathColumn(sfValidatedFile $file)
  {
    $image = new sfImage($file->getTempName(), $file->getType());

    // Transform your $image here, but don't save it...
    unset($image); // instead

    // default symfony file saving logic
    return $this->processUploadedFile('image_filepath'); // 'image_filepath'
should be column name where you store image filepath
  }

  /*
   * Create method name after *generate%column_name%Filename()* where
%column_name%
   * is camelized column name where you store image filepath.
   */
  protected function generateImageFilepathFilename(sfValidatedFile $file)
  {
    //optionaly you can...
    return $new_filename_for_image_file; // ...here
  }
}

Personally, I recommend
sfImageTransformExtraPlugin<http://www.symfony-project.org/plugins/sfImageTransformExtraPlugin>.
It is very unobstrusive, which means it requires less work for developer
(You).

Cheers, Alan

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to