循环通过图像阵列并移动它们 - Laravel

时间:2015-07-02 08:59:12

标签: php image image-processing laravel-4

我有一个包含5个文件输入的表单来创建图像数组。

处理时,我希望遍历图像并处理它们。

$images = Input::get('images');
// image proccessing
foreach ($images as $image) {
  print_r($image);
}

那将输出文件名,但如果我在$ image变量上调用move函数,我会得到“在字符串上调用方法移动”。

我该怎么做?

1 个答案:

答案 0 :(得分:0)

You should be doing something like this 

       $input = Input::file('files'); //get file as input
        //check if input has file 
        if ($input){
            foreach($input as $key){
            //loop through file and perform action...
              $array = Image::file_upload($key, 'file', 'Images');
              // I assume you have your method for upload like the above
              $key = $array['filename'];
              print_r($key);    
            }
        }
        $this->image->save($input); //save to db file name.