使用laravel 4.2进行干预\ Image \ Exception \ NotReadableException

时间:2015-10-28 03:23:22

标签: php image file-upload laravel-4

我远程代码中的这个错误使我感到痛苦,它可以在我的本地应用程序上运行,但它不在线,请花时间在线体验http://popibay.com/petads/post/?cat=dog&location=lagos&lga=amuwo-odofin使用网络选项卡下的chrome检查器进行调试

  public function image(){

  $all_inputs = Input::all();
  $files = Input::file('file');

  $app_token = Input::get('_token');
  // setting up rules

    if (Input::hasFile('file')) {

     foreach ($files as $file) {
      $destinationPath = 'public/pb-uploads/pet_images/'; // upload path
      $thumbnail_path = 'public/pb-uploads/pet_images_thumbnail/';
      $popibay_watermark = 'public/pb-uploads/pet_images/popibay_white_logo_watermark/popibay_watermark_logo.png';
      $popibay_watermark_new = 'public/pb-uploads/pet_images/popibay_white_logo_watermark/popibay_watermark_opacity_logo.png';
      $extension = $file->getClientOriginalExtension(); // getting image extension
      $original_name = $file->getClientOriginalName();
      $random_number = rand(11111,99999);
      $fileName = $random_number.'.'.$extension; // renaming image


      // Image::make($file)->resize(600, 357)->insert($popibay_watermark_new,'center')->save($destinationPath.$fileName);

      Image::make($file)->insert($popibay_watermark_new,'center')->save($destinationPath.$fileName);

      Image::make($file)->resize(125, 155)->save($thumbnail_path.$fileName); // thumbnail image

      // $domain = 'http://popibay.com';
      $domain = 'http://' . $_SERVER["HTTP_HOST"];
      $destinationPath = '/pb-uploads/pet_images/'; // upload path
      $thumbnail_path = '/pb-uploads/pet_images_thumbnail/';
      $temp_id = rand(1,100);

      // save temp_id value to session...

      // $temp_saved_id = Petimage::where('temp_id','=',$temp_id)->first();
      // $temp_saved_id = $temp_saved_id->temp_id;

      $saved_temp_id = Session::get('saved_temp_id');

      if ( isset($saved_temp_id) ) {

        $pet_image = new Petimage;
        $pet_image->temp_id = $saved_temp_id;
        $pet_image->petad_id = 0;
        $pet_image->original_name = $original_name;
        $pet_image->image_path = $domain.$destinationPath.$fileName;
        $pet_image->image_thumbnail_path = $domain.$thumbnail_path.$fileName;
        $pet_image->image_name = $fileName;
        $pet_image->save();

        exit;

      }

      // Save to image table...
      $pet_image = new Petimage;
      $pet_image->temp_id = $temp_id;
      $pet_image->petad_id = 0;
      $pet_image->original_name = $original_name;
      $pet_image->image_path = $domain.$destinationPath.$fileName;
      $pet_image->image_thumbnail_path = $domain.$thumbnail_path.$fileName;
      $pet_image->image_name = $fileName;
      $pet_image->save();

      Session::put('saved_temp_id', $temp_id);

     }
}

然后这是文件夹pb-uploads / permissions。

pbadmin@popibayvm ~> cd /var/www/html/popibay_azure/public/
pbadmin@popibayvm /v/w/h/p/public> ls -la
drwxr-xr-x 5 pbadmin pbadmin  4096 Sep 13 13:45 ./
drwxr-xr-x 6 pbadmin pbadmin  4096 Sep  8 22:11 ../
drwxr-xr-x 3 pbadmin pbadmin  4096 Sep  8 22:41 packages/
drwxr-xr-x 7 pbadmin pbadmin  4096 Sep  8 22:33 pb-assets/
drwxrwxrwx 4 pbadmin pbadmin  4096 Oct 24 08:33 pb-uploads/

0 个答案:

没有答案