警告:getimagesize无法打开流:没有这样的文件或目录

时间:2014-01-18 10:33:48

标签: php zend-framework

您好我正在研究zend框架并尝试在上传后裁剪图像并保存裁剪后的图像,但我不断得到路径错误。我正在使用Windows平台。请有人帮助我。 我收到了这个错误 警告:getimagesize(C:\ wamp \ www \ ModuleEx.com/public/image/)[function.getimagesize]:无法打开流:C:\ wamp \ www \ ModuleEx.com \ application \中没有此类文件或目录第21行的modules \ admin \ controllers \ IndexController.php

这是我的代码

public function indexAction()
{
    if(isset($_FILES["img"]["name"])){
        $names = $_FILES["img"]["name"];
        $tmp = $_FILES["img"]["tmp_name"];
        $upload_dir = "./public/image/".$names;

        $move=move_uploaded_file($tmp, "$upload_dir");

        $a="/public/image/".$names;
        $this->view->a = $upload_dir;
        $b=BASE_PATH."/public/image/".$names;

        list($width, $height) = getimagesize($b);

        $newwidth = "150"; 
        $newheight = "90";
        $thumb = imagecreatetruecolor($newwidth, $newheight);
        if($_FILES["img"]["type"]=="image/jpeg"){
            $source = imagecreatefromjpeg($b);
            imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width,   $height);
            imagejpeg($thumb,BASE_PATH."/public/image/".$names , 90);

        }
    }
} 

0 个答案:

没有答案