上传并显示视频的缩略图

时间:2015-07-20 07:20:09

标签: php video upload video-streaming mime

您好,我正在为我的公司工作,公司希望我建立一个视频共享网站,我已经制作了所有的基本功能和界面,但现在我遇到上传视频到网站并在上传后显示缩略图的问题通过建议一些插件或任何形式的帮助来帮助我是非常重要的。

我将通过以下代码上传视频

 var progressbarhead     = $('#progressbarhead');
var statustxthead       = $('#statustxthead');
 $(document).ready(function() { 
var options = { 
        target:   '#output909090jk',   // target element(s) to be updated with server response 
        uploadProgress: OnProgresshead,
        beforeSubmit:  beforeSubmit,  // pre-submit callback 
    }; 

 $('#thef_op90op').submit(function() { 
        $(this).ajaxSubmit(options);            
        // always return false to prevent standard browser submit and page navigation 
        return false; 
    }); 
    }); 
     function OnProgresshead(event, position, total, percentComplete)
   {
//Progress bar
progressbarhead.width(percentComplete + '%') //update progressbar percent complete
statustxthead.html(percentComplete + '%'); //update status text
 }
   //function to check file size before uploading.
  function beforeSubmit(){
//check whether browser fully supports all File API
  if (window.File && window.FileReader && window.FileList && window.Blob)
    {

      if( !$('#file09_09o9').val()) //check empty input filed
    {
        $("#output").html("Please choose a image for your ad - camera button     above this message.");
        return false
    }

    var fsize = $('#file09_09o9')[0].files[0].size; //get file size
    var ftype = $('#file09_09o9')[0].files[0].type; // get file type


    //allow only valid image file types 
    switch(ftype)
    {
        case 'image/png': case 'image/gif': case 'image/jpeg': case 'image/pjpeg':
            break;
        default:
            $("#output").html("<b>"+ftype+"</b> Unsupported file type!");
            return false
    }

    //Allowed file size is less than 1 MB (1048576)
    if(fsize>3048576) 
    {
        $("#output").html("<b>"+bytesToSize(fsize) +"</b> Too big Image file! <br />Please reduce the size of your photo using an image editor.");
        return false
    }

    $("#output").html("");  
}
else
{
    //Output error to older unsupported browsers that doesn't support HTML5 File API
    $("#output").html("Please upgrade your browser, because your current browser lacks some new features we need!");
    return false;
}
}

html在这里

 <input type="file" name="profileimage99" style="display:nonle;" onchange="$('#ok_po90klk').click();" id="file09_09o9">
                        <input type="submit" name="filesubmited" value="upload" id="ok_po90klk" class="the_SUb_mit_Upload6"/>

还建议我使用视频的任何mime类型。

0 个答案:

没有答案