我想不通。当我像这样调整上传图片的大小时,
public function up(Request $request) {
$user = $request->user();
$image= $request->file('images');
if(!empty(($image))){
$files = Input::file('images');
foreach($files as $file) {
if(!empty($file)){
$new_file = Image::make($file)->resize(200,200);
var_dump($new_file);exit;
var_dump 返回:
object(Intervention\Image\Image)#241 (9) {
object(Intervention\Image\Imagick\Driver)#242 (2) {
["decoder"] object(Intervention\Image\Imagick\Decoder)#243 (1) {
}
["encoder"] object(Intervention\Image\Imagick\Encoder)#244 (4) {
["result"] NULL
["image"] NULL
["format"] NULL
["quality"] NULL
}
}
object(Imagick)#237 (0) {
}
["backups":protected] array(0) {
}
["encoded"] ""
["mime"] "image/jpeg"
["dirname"] "/Applications/MAMP/tmp/php"
["basename"] "phpJcAyxV"
["extension"] NULL
["filename"] "phpJcAyxV"
}
结果、图像、格式、质量全部为空。我在这里想念什么?
更新这是 HTML:
{!! Form::open(array('action'=>'FileController@up','files'=>true,))!!}
<div class='row'>
<div class='col-md-2'>
{!! Form::label('images','Profile Picture')!!}
</div>
<div class='col-md-2 profile-pic'>
@if(isset($pic))
<img src='{{$pic}}'/>
@else
<img src='/images/user-icon.jpg'/>
@endif
</div>
<div class='col-md-6'>
{!! Form::file('images[]') !!}
{!! Form::hidden('category','profile')!!}
{!! Form::submit('Upload',['class'=>'form-control btn btn-md btn-info','style'=>'width:100px; margin-top:50px;'])!!}
</div>
</div>
{!! Form::close()!!}
也许我不应该使用数组?