S3 :: inputFile():无法打开输入文件:.jpg

时间:2016-08-19 11:41:25

标签: php amazon-web-services amazon-s3 yii2

尝试将文件上传到php中的s3存储桶。

我正在将视频.mp4大小(1 mb)上传到mybucket / temp文件夹并从该视频中剪切拇指文件(临时文件夹仅在s3存储桶中)。

那是我的代码: -

   $video_type = strtolower(pathinfo($video_name, PATHINFO_EXTENSION));
  //Create object S3 ,File path models/S3.php
   $object_s3 = new S3(Yii::$app->params['aws_access_key'], Yii::$app->params['aws_secret_key']);
   //bucket name 
         $Amazon_Bucket = "abc-videos";
        //create image name dynamically and unique
          $uploadimage = $insert_videoid . "-thumb.jpg";
         //create video name dynamically and unique
            $uploadvideo = $insert_videoid . "-video." . $video_type;
            exec("ffmpeg -i " . $videotempname . " -deinterlace -an -ss 00:00:05 -t 00:00:01 -s 150x150 -r 1 -y -vcodec mjpeg -f mjpeg " . $uploadimage . " 2>&1");
             $thumbfile = $insert_videoid . "/thumb-" . $insert_videoid . ".jpg";
            if ($object_s3->putObjectFile($videotempname, $Amazon_Bucket, $uploadvideo, S3::ACL_PUBLIC_READ)) {
        //create url and update in tbl_video
           $object_s3->putObjectFile($uploadimage, $Amazon_Bucket, $thumbfile, S3::ACL_PUBLIC_READ);
           $url = "http://" . $abc . ".s3.amazonaws.com/" . $uploadvideo;

0 个答案:

没有答案