How can I change size of image during upload ? I use
sfImageTransformPlugin to do that.


//take information about uploading image:
$code = md5(uniqid(mt_rand()));
$file = $this->form->getValue('image');
$filename = $code;
$extension = $file->getExtension($file->getOriginalExtension());
$newname = $filename.$extension;



//use sfImageTransformPlugin to resize image and save:
$img = new sfImage( ..........??.................);
$response = $this->getResponse();
$response->setContentType($img->getMIMEType());
if($img->getWidth() > 400 || $img->getHeight() > 400)
{
                        if($img->getWidth() > $img->getHeight()) 
$img->resize(400,null);
                        else $img->resize(null,400);
}
$img->saveAs(sfConfig::get('sf_upload_dir'). DIRECTORY_SEPARATOR .
$newname);


What should I write in new sfImage() ?? I must write there path to
upload image but image isn't yet uploaded - so what should I write
there ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to