codeigniter教程之上傳視頻并使用ffmpeg轉(zhuǎn)flv示例
$file = 'video_file';
$config['upload_path'] = './video_folder/';
$config['allowed_types'] = 'mov|mpeg|mp3|avi';
$config['max_size'] = '50000';
$config['max_width'] = '';
$config['max_height'] = '';
$this->upload->initialize($config);
$this->load->library('upload', $config);
if(!$this->upload->do_upload($file))
{
// If there is any error
$err_msgs .= 'Error in Uploading video '.$this->upload->display_errors().'<br />';
}
else
{
$data=array('upload_data' => $this->upload->data());
$video_path = $data['upload_data']['file_name'];
$directory_path = $data['upload_data']['file_path'];
$directory_path_full = $data['upload_data']['full_path'];
$file_name = $data['upload_data']['raw_name'];
// ffmpeg command to convert video
exec("ffmpeg -i ".$directory_path_full." ".$directory_path.$file_name.".flv");
// $file_name is same file name that is being uploaded but you can give your custom video name after converting So use something like myfile.flv.
/// In the end update video name in DB
$array = array(
'video' => $file_name.'.'.'flv',
);
$this->db->set($array);
$this->db->where('id',$id); // Table where you put video name
$query = $this->db->update('user_videos');
}
- CI框架文件上傳類及圖像處理類用法分析
- SWFUpload與CI不能正確上傳識別文件MIME類型解決方法分享
- 2個Codeigniter文件批量上傳控制器寫法例子
- Codeigniter實現(xiàn)多文件上傳并創(chuàng)建多個縮略圖
- codeigniter教程之多文件上傳使用示例
- php基于CodeIgniter實現(xiàn)圖片上傳、剪切功能
- codeigniter上傳圖片不能正確識別圖片類型問題解決方法
- Codeigniter上傳圖片出現(xiàn)“You did not select a file to upload”錯誤解決辦法
- 使用CodeIgniter的類庫做圖片上傳
- CodeIgniter上傳圖片成功的全部過程分享
- CI框架實現(xiàn)優(yōu)化文件上傳及多文件上傳的方法
相關文章
Laravel學習教程之request validation的編寫
這篇文章主要給大家介紹了關于Laravel學習教程之request validation編寫的相關資料,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧。2017-10-10
ThinkPHP中Widget擴展的兩種寫法及調(diào)用方法詳解
這篇文章主要介紹了ThinkPHP中Widget擴展的兩種寫法及調(diào)用方法,詳細分析了Widget擴展的寫法及相應的調(diào)用技巧,需要的朋友可以參考下2017-05-05
laravel解決遷移文件一次刪除創(chuàng)建字段報錯的問題
今天小編就為大家分享一篇laravel解決遷移文件一次刪除創(chuàng)建字段報錯的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-10-10
php之XML轉(zhuǎn)數(shù)組函數(shù)的詳解
本篇文章是對php中的XML轉(zhuǎn)數(shù)組函數(shù)進行了詳細的分析介紹,需要的朋友參考下2013-06-06
PHP將amr音頻文件轉(zhuǎn)換為mp3格式的操作細節(jié)
本文以centos服務器安裝ffmpeg為例,給大家詳細介紹PHP將amr音頻文件轉(zhuǎn)換為mp3格式的操作細節(jié),感興趣的朋友跟隨小編一起看看吧2021-07-07
關于 Laravel Redis 多個進程同時取隊列問題詳解
這篇文章主要給大家介紹了關于 Laravel Redis 多個進程同時取隊列問題的相關資料,文中通過示例代碼介紹的非常詳細,對大家的學習或工作具有一定的參考學習價值,需要的朋友下面來一起學習學習吧。2017-12-12

