pawlox / video-thumbnail

Laravel package for generating thumbnails from videos
22 stars 14 forks source link

Class "App\Http\Controllers\VideoThumbnail" not found #11

Open seoasia-co opened 1 year ago

seoasia-co commented 1 year ago

local.ERROR: Class "App\Http\Controllers\VideoThumbnail" not found {"userId":1,"exception":"[object] (Error(code: 0): Class \"App\Http\Controllers\VideoThumbnail\" not found at /app/Http/Controllers/MainController.php:316)

seoasia-co commented 1 year ago

I've tried all php artisan optimize:clear and composer dump-autoload

pawlox commented 1 year ago

I looks like it tries to find VideoThumbnail class in your /app/Http/Controllers folder, did you used right namespace for VideoThumbnail Facade?

seoasia-co commented 1 year ago

I follow your instruction and add in config.php 'providers' Pawlox\VideoThumbnail\VideoThumbnailServiceProvider::class, and alias 'VideoThumbnail' => Pawlox\VideoThumbnail\Facade\VideoThumbnail::class,

that 's it all I saw in your instruction.

seoasia-co commented 1 year ago

Need I have to create controller? php artisan make:controller VideoThumbnail ?

but I saw the same problem in many forum and they run php artisan cache:clear then it work. but It's not for me.

seoasia-co commented 1 year ago

for example https://stackoverflow.com/questions/55494689/class-videothumbnail-for-found-in-laravel

seoasia-co commented 1 year ago

Composer install:

composer require pawlox/video-thumbnail After package installation, add the ServiceProvider to the providers array in config/app.php

Pawlox\VideoThumbnail\VideoThumbnailServiceProvider::class And to the aliases array

'VideoThumbnail' => Pawlox\VideoThumbnail\Facade\VideoThumbnail::class Also you can publish package config file with:

php artisan vendor:publish --tag=video-thumbnail and set ffmpeg and ffprobe paths in .env file:

FFMPEG="/usr/bin/ffmpeg" FFPROBE="/usr/bin/ffprobe"

seoasia-co commented 1 year ago

then I call this in the place I should call in other controller

VideoThumbnail::createThumbnail( public_path('files/movie.mp4'), public_path('files/thumbs/'), 'movie.jpg', 2, 1920, 1080 );

pawel-omniaz commented 1 year ago

Try to add

use Pawlox\VideoThumbnail\Facade\VideoThumbnail;

at the top of the controller.