title: Failed to open stream: No such file or directory
body: <p>Hi i am new to php and i am working on image upload and crop and save bth upload and cropped image in zend on windows 7 but it's giving me these errors. Please help me to solve these errors.</p>
  
  <p><code>Warning: imagecreatefromjpeg(public/image/) [&lt;a href='function.imagecreatefromjpeg'&gt;function.imagecreatefromjpeg&lt;/a&gt;]: failed to open stream: No such file or directory in C:\wamp\www\ModuleEx.com\application\modules\admin\controllers\IndexController.php on line 64</code></p>
  
  <p><code>Warning: imagecopyresampled() expects parameter 2 to be resource, boolean given in C:\wamp\www\ModuleEx.com\application\modules\admin\controllers\IndexController.php on line 68</code></p>
  
  <p><code>Warning: imagejpeg() [&lt;a href='function.imagejpeg'&gt;function.imagejpeg&lt;/a&gt;]: Unable to open 'public/image/crop/' for writing: No such file or directory in C:\wamp\www\ModuleEx.com\application\modules\admin\controllers\IndexController.php on line 71</code></p>
  
  <p>Here is my controller.php code.</p>
  
  <pre><code>if(isset($_FILES['file']['name'])){ //user upload file
      $file_name = stripslashes($_FILES['file']['name']);
      $ext_idx = strrpos($file_name,".");
      if(!$ext_idx) //hide this if ur app can upload without ext
          echo "File invalid.";
      else{
          $ext_length = strlen($file_name) - $ext_idx;
          $extension = strtolower(substr($file_name,$ext_idx+1,$ext_length));
          //allowed extension
          $ext_list = array("pdf", "doc","jpg", "jpeg", "gif", "png");
          if(!in_array($extension, $ext_list))
              echo "System can't support your extension.";
          else{
              $size = (2500 * 1024); //2500 Kb
              $file_size=filesize($_FILES['file']['tmp_name']);
              if($file_size &gt; $size)
                  echo "File is oversize. Max 2500 Kb.";
              else{
                  //change name
                  $file_name = "image".rand(10,1000).".".$extension;
  
                  $file_obj="public/image/".$file_name;
  
  
  
                  $copied = copy($_FILES['file']['tmp_name'], $file_obj);
  
                  if(!$copied)
                      echo "Failed.";
                  else 
                  {
  
                      $file_data = array( 'file_name' =&gt; $file_name );
  
  
                      $this-&gt;view-&gt;file_obj=$file_obj;
  
  
  
  
                  }
                  }
  
              }
          }
      }
  if ($_SERVER['REQUEST_METHOD'] == 'POST')
  {
   $targ_w = $targ_h = 150;
   $jpeg_quality = 90;
   $src = "public/image/".$file_name;
  
  $img_r = imagecreatefromjpeg($src);
   $dst_r = ImageCreateTrueColor( $targ_w, $targ_h );
  
   imagecopyresampled($dst_r,$img_r,0,0,(int)$_POST['x'],(int)$_POST['y'],
   $targ_w,$targ_h,(int)$_POST['w'],(int)$_POST['h']);
  
  //header('Content-type: image/jpeg');
    imagejpeg($dst_r,"public/image/crop/".$file_name,$jpeg_quality);
  
     }
  </code></pre>