Php Symfony 2:GregWare:ImageBundle和MAMP出错
我尝试将GregWare:ImageBundle与MAMP一起使用。 当我尝试Php Symfony 2:GregWare:ImageBundle和MAMP出错,php,symfony,Php,Symfony,我尝试将GregWare:ImageBundle与MAMP一起使用。 当我尝试 Image::open($this->file); Symfony给了我一个 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和EXIF安装正确 在我
Image::open($this->file);
Symfony给了我一个
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和EXIF安装正确
在我的debian服务器中,我可以毫无问题地使用这个包
如果我打印$this->file
,我在查找器中找不到相应的文件。我试图chmod
文件夹,但没有成功
编辑:
在我的控制器中,当我提交表单时,我会这样做。文件是文件类型中的“文件”。
如果($request->getMethod()=='POST'){
$form->bind($request)
这里是我的上传功能,在我的主要实体中包含该文件
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);
(...)
如果您打印
$this->file
,它会显示什么?它会显示我的应用程序/MAMP/tmp/php/phpgyJxnA。我用finder找不到这个文件$this->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);
(...)