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不能正確上傳識(shí)別文件MIME類型解決方法分享
- 2個(gè)Codeigniter文件批量上傳控制器寫(xiě)法例子
- Codeigniter實(shí)現(xiàn)多文件上傳并創(chuàng)建多個(gè)縮略圖
- codeigniter教程之多文件上傳使用示例
- php基于CodeIgniter實(shí)現(xiàn)圖片上傳、剪切功能
- codeigniter上傳圖片不能正確識(shí)別圖片類型問(wèn)題解決方法
- Codeigniter上傳圖片出現(xiàn)“You did not select a file to upload”錯(cuò)誤解決辦法
- 使用CodeIgniter的類庫(kù)做圖片上傳
- CodeIgniter上傳圖片成功的全部過(guò)程分享
- CI框架實(shí)現(xiàn)優(yōu)化文件上傳及多文件上傳的方法
相關(guān)文章
Laravel學(xué)習(xí)教程之request validation的編寫(xiě)
這篇文章主要給大家介紹了關(guān)于Laravel學(xué)習(xí)教程之request validation編寫(xiě)的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。2017-10-10
PHP編寫(xiě)daemon process詳解及實(shí)例代碼
這篇文章主要介紹了PHP編寫(xiě)daemon process詳解的相關(guān)資料,并附實(shí)例代碼,有需要的小伙伴可以參考下2016-09-09
ThinkPHP中Widget擴(kuò)展的兩種寫(xiě)法及調(diào)用方法詳解
這篇文章主要介紹了ThinkPHP中Widget擴(kuò)展的兩種寫(xiě)法及調(diào)用方法,詳細(xì)分析了Widget擴(kuò)展的寫(xiě)法及相應(yīng)的調(diào)用技巧,需要的朋友可以參考下2017-05-05
laravel解決遷移文件一次刪除創(chuàng)建字段報(bào)錯(cuò)的問(wèn)題
今天小編就為大家分享一篇laravel解決遷移文件一次刪除創(chuàng)建字段報(bào)錯(cuò)的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-10-10
php之XML轉(zhuǎn)數(shù)組函數(shù)的詳解
本篇文章是對(duì)php中的XML轉(zhuǎn)數(shù)組函數(shù)進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-06-06
PHP將amr音頻文件轉(zhuǎn)換為mp3格式的操作細(xì)節(jié)
本文以centos服務(wù)器安裝ffmpeg為例,給大家詳細(xì)介紹PHP將amr音頻文件轉(zhuǎn)換為mp3格式的操作細(xì)節(jié),感興趣的朋友跟隨小編一起看看吧2021-07-07
關(guān)于 Laravel Redis 多個(gè)進(jìn)程同時(shí)取隊(duì)列問(wèn)題詳解
這篇文章主要給大家介紹了關(guān)于 Laravel Redis 多個(gè)進(jìn)程同時(shí)取隊(duì)列問(wèn)題的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。2017-12-12

