从Codeigniter中的视频生成缩略图

时间:2018-09-27 06:07:24

标签: php mysql sql codeigniter ffmpeg-php

我想从上传的视频中生成缩略图,但问题是未生成缩略图。上传的视频转到了uploads文件夹,但是在该位置图像没有生成。请查看代码,并告诉我我错了。

public function add_video() {                   // move_upload_file code

    if(!empty($_FILES['video']['name'])){

        $tmp_name_array = $_FILES['video']['tmp_name'];
        $n_array = $_FILES['video']['name'];
        $exp = explode('.', $n_array);
        $newnme = date('his').rand().'.'.end($exp);
        $raw_name = explode('.', $newnme);

        $full_path = base_url('uploads').'/'.$newnme;
        $new_path = base_url('uploads').'/';
        if(move_uploaded_file($tmp_name_array, "uploads/".$newnme))
        {                
            $full_path = base_url('uploads').'/'.$newnme;
            $new_path = base_url('uploads').'/';

            print_r(exec("ffmpeg -i ".$full_path." ".$new_path.$raw_name[0].".jpg"));

            echo "uploaded Successfully";
        }
    }else{

        echo "not selected any file";
    }
}

0 个答案:

没有答案