<i id='jqEBP'><tr id='jqEBP'><dt id='jqEBP'><q id='jqEBP'><span id='jqEBP'><b id='jqEBP'><form id='jqEBP'><ins id='jqEBP'></ins><ul id='jqEBP'></ul><sub id='jqEBP'></sub></form><legend id='jqEBP'></legend><bdo id='jqEBP'><pre id='jqEBP'><center id='jqEBP'></center></pre></bdo></b><th id='jqEBP'></th></span></q></dt></tr></i><div id='jqEBP'><tfoot id='jqEBP'></tfoot><dl id='jqEBP'><fieldset id='jqEBP'></fieldset></dl></div>

<small id='jqEBP'></small><noframes id='jqEBP'>

    <bdo id='jqEBP'></bdo><ul id='jqEBP'></ul>
    <tfoot id='jqEBP'></tfoot>

    1. <legend id='jqEBP'><style id='jqEBP'><dir id='jqEBP'><q id='jqEBP'></q></dir></style></legend>
      1. 干预图像异常 NotReadableException使用laravel 4

        时间:2023-10-31
          <bdo id='bjsKB'></bdo><ul id='bjsKB'></ul>
          <i id='bjsKB'><tr id='bjsKB'><dt id='bjsKB'><q id='bjsKB'><span id='bjsKB'><b id='bjsKB'><form id='bjsKB'><ins id='bjsKB'></ins><ul id='bjsKB'></ul><sub id='bjsKB'></sub></form><legend id='bjsKB'></legend><bdo id='bjsKB'><pre id='bjsKB'><center id='bjsKB'></center></pre></bdo></b><th id='bjsKB'></th></span></q></dt></tr></i><div id='bjsKB'><tfoot id='bjsKB'></tfoot><dl id='bjsKB'><fieldset id='bjsKB'></fieldset></dl></div>

              <tfoot id='bjsKB'></tfoot>
            • <small id='bjsKB'></small><noframes id='bjsKB'>

                <legend id='bjsKB'><style id='bjsKB'><dir id='bjsKB'><q id='bjsKB'></q></dir></style></legend>
                    <tbody id='bjsKB'></tbody>

                1. 本文介绍了干预图像异常 NotReadableException使用laravel 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 laravel 4 并安装了 Intervention Image 包.当我在我的代码中使用它时 method ->resize, ->move etc etc... 我有这个 error:

                  I'm using laravel 4 and I installed the Intervention Image package. When I'm using it in my code whith method ->resize, ->move etc etc etc... I have this error:

                  Intervention  Image  Exception  NotReadableException
                  

                  图片来源不可读

                  open: /Applications/MAMP/htdocs/myNameProject/vendor/intervention/image/src/Intervention/Image/AbstractSource.php
                  
                          break;
                  
                          case $this->isFilePath():
                              return $this->initFromPath($this->data);
                              break;
                  
                          default:
                              throw new ExceptionNotReadableException("Image source not readable");
                              break;
                      }
                  

                  如果对您有帮助的话,我还在 MAC OS 上使用 MAMP 和 Sublime Text 3.

                  I'm also using MAMP and Sublime Text 3 on MAC OS if it could help you.

                  这是我在控制器中的代码:

                  public function upload() {
                  
                  //***** UPLOAD FILE (on server it's an image but an Url in Database *****//
                  
                  // get the input file
                  $file = Image::make('url_Avatar');
                  
                  //set a register path to the uploaded file
                  $destinationPath = public_path().'upload/';
                  
                  //have client extension loaded file and set a random name to the uploaded file, produce a random string of length 32 made up of alphanumeric characters [a-zA-z0-9]
                  $filename = $destinationPath . '' . str_random(32) . '.' . $file->getClientOriginalExtension();
                  //$file->move($destinationPath,$filename);
                  
                  //set $file in order to resize the format and save as an url in database
                  $file= Image::make($image->getRealPath())->resize('200','200')->save('upload/'.$filename);
                  
                  //*****VALIDATORS INPUTS and RULES*****
                  $inputs = Input::all();
                  $rules = array(
                  'pseudo' => 'required|between:1,64|unique:profile,pseudo',
                  //urlAvatar is an url in database but we register as an image on the server
                  'url_Avatar' => 'required|image|min:1',
                  );
                  

                  (我没有向你展示我的视图的重定向,但它在我的控制器的这一部分工作得很好)

                  这是我的表单代码(使用刀片 laravel 模板):

                  @extends('layout.default')
                  @section('title')
                  Name Of My Project - EditProfile
                  @stop
                  
                  @section('content')
                  {{Form::open(array('url'=>'uploadAvatar','files' => true))}}
                  
                  <p>
                  {{Form::label('pseudo','pseudo (*): ')}}
                  {{Form::text('pseudo',Input::old('nom'))}}
                  </p>
                  @if ($errors->has('pseudo'))
                  <p class='error'> {{ $errors->first('pseudo')}}</p>
                  @endif
                  <br>
                  <br>
                  
                  <p>
                  {{Form::label('url_Avatar','Avatar: ')}}
                  {{Form::file('url_Avatar',Input::old('Url_Avatar'))}}
                  </p>
                  @if ($errors->has('url_Avatar'))
                  <p class='error'> {{ $errors->first('url_Avatar')}}</p>
                  @endif
                  <br>
                  <br>
                  
                  <p>
                  {{Form::submit('Validate your avatar')}}
                  </p>
                  
                  {{Form::close()}}
                  @stop
                  

                  当然我已经安装了Intervention Image包 按照官网image.intervention.io/getting_started/installation强>(网址).

                  Of course I have installed Intervention Image package following the official website image.intervention.io/getting_started/installation (url).

                  如何使我的文件可读"?或解决此错误?

                  How can I make my file "readable"? or resolve this error?

                  推荐答案

                  改变这个:

                  $file = Image::make('url_Avatar');
                  

                  为此:

                  $file = Input::file('url_Avatar');
                  // ...
                  $filename = '...';
                  Image::make($file->getRealPath())->resize('200','200')->save($filename);
                  

                  详细了解 Laravel 文档中的文件.

                  这篇关于干预图像异常 NotReadableException使用laravel 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  <i id='8reVj'><tr id='8reVj'><dt id='8reVj'><q id='8reVj'><span id='8reVj'><b id='8reVj'><form id='8reVj'><ins id='8reVj'></ins><ul id='8reVj'></ul><sub id='8reVj'></sub></form><legend id='8reVj'></legend><bdo id='8reVj'><pre id='8reVj'><center id='8reVj'></center></pre></bdo></b><th id='8reVj'></th></span></q></dt></tr></i><div id='8reVj'><tfoot id='8reVj'></tfoot><dl id='8reVj'><fieldset id='8reVj'></fieldset></dl></div>

                  • <bdo id='8reVj'></bdo><ul id='8reVj'></ul>
                  • <legend id='8reVj'><style id='8reVj'><dir id='8reVj'><q id='8reVj'></q></dir></style></legend>
                          <tbody id='8reVj'></tbody>

                        <small id='8reVj'></small><noframes id='8reVj'>

                          <tfoot id='8reVj'></tfoot>