承接 ksolutions/videotothumbbyks 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ksolutions/videotothumbbyks

最新稳定版本:v1.0.1

Composer 安装命令:

composer require ksolutions/videotothumbbyks

包简介

A package to create thumbnails from videos and images for Laravel and Core PHP

README 文档

README

videotothumbbyks

This package is created by Khemraj Sharma if you have any Queries then Please contact me at captainjacksparrow295@gmail.com

Step ---1 ---- Install this package

composer require ksolutions/videotothumbbyks

Step ---2 ----

sudo apt update

sudo apt install ffmpeg

Step ---3 ----

In your Controller

use KSolutions\VideoToThumb\VideoToThumb;

public function uploadVideo(Request $request)

{

try {
    if (!$request->hasFile('video')) {
        return response()->json(['status' => 'failed', 'message' => 'No video file uploaded']);
    }
    $file = $request->file('video');
    $time = time();
    $videoPath = $file->storeAs('public/videos', $time.'-video.mp4');
    $videoFullPath = storage_path('app/' . $videoPath);
    $thumbnailPath = storage_path('app/public/thumbnails/'.$time.'-thumbnail.jpg');
    $videoToThumb = new VideoToThumb();
    $result = $videoToThumb->generateVideoThumbnail($videoFullPath, $thumbnailPath, 5);
    if ($result) {
        return response()->json(['status' => 'success', 'message' => 'Thumbnail generated successfully', 'thumbnail' => $thumbnailPath]);
    } else {
        return response()->json(['status' => 'failed', 'message' => 'Thumbnail generation failed']);
    }
} catch (Exception $e) {
    // Catch and display the exception message
    return response()->json(['status' => 'error', 'message' => $e->getMessage()]);
}

}

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-25