Symfony 2:GregWare出错:ImageBundle和MAMP

I try to use GregWare:ImageBundle with MAMP. When I try a

Image::open($this->file);

Symfony gives me a

Warning: imagejpeg(): Invalid 2nd parameter, it must a filename or a stream in /XXX/vendor /gregwar/image-bundle/Gregwar/ImageBundle/Image.php line 979

GD and EXIF are correctly installed.

In my debian server, I can use this bundle without any problems.

If I print $this->file, I can't find the corresponding file in my finder. I tried to chmod the folder without success.

EDIT:

In my controller, when i submit the form, i do that. File is "file" from file type. if ($request->getMethod() == 'POST') { $form->bind($request);

        if ($form->isValid()) {
                            $annonce->uploadMainFile();
            $annonce->setEnable(true);
            $em = $this->get('doctrine')->getManager();
            $em->persist($annonce);
            $em->flush();
            //TODO redirect
            return $this->redirect(
                    $this->generateUrl('xxx_core_moncompte'));

Here is my upload function in my main entity containing the file

public function uploadMainFile(){

        $hCible = 205;
        $lCible = 277;
        $ratioCible = $lCible/$hCible;

        if($this->file!=null){
            $size = getimagesize($this->file);
            $haut=$size[1];
            $larg=$size[0];
            $ratio = $larg/$haut;

            if($ratio>$ratioCible){

                //Resize by height
                Image::open($this->file)
                    ->resize(null, $hCible)
                    ->save($this->file);
     (...)