Closed Romik90 closed 5 years ago
This is not a Vanilo but a Spatie Media Library related question.
Does your model implement the HasMediaTrait?
This package already contains an admin area where you can upload images. It's ok to not use it, but you can take it as a reference implementation, in this particular case refer to this file:
https://github.com/vanilophp/framework/blob/master/src/Http/Controllers/MediaController.php#L44
I create product images using temporary pictures stored in storage
Here is a part of my Product model
And here is a part of vanilo config
If I uncomment 'queued' => true strings I get following error Spatie\MediaLibrary\Exceptions\InvalidConversion: There is no conversion named
large
in /var/www/html/soulmade/vendor/spatie/laravel-medialibrary/src/Exceptions/InvalidConversion.php:11 Stack trace:0 /var/www/html/soulmade/vendor/spatie/laravel-medialibrary/src/Conversion/ConversionCollection.php(61): Spatie\MediaLibrary\Exceptions\InvalidConversion::unknownName('large')
1 /var/www/html/soulmade/vendor/spatie/laravel-medialibrary/src/UrlGenerator/UrlGeneratorFactory.php(27): Spatie\MediaLibrary\Conversion\ConversionCollection->getByName('large')
2 /var/www/html/soulmade/vendor/spatie/laravel-medialibrary/src/Models/Media.php(74): Spatie\MediaLibrary\UrlGenerator\UrlGeneratorFactory::createForMedia(Object(Spatie\MediaLibrary\Models\Media), 'large')
3 /var/www/html/soulmade/vendor/spatie/laravel-medialibrary/src/FileManipulator.php(81): Spatie\MediaLibrary\Models\Media->getPath('large')
4 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Support/Collection.php(1516): Spatie\MediaLibrary\FileManipulator->Spatie\MediaLibrary{closure}(Object(Spatie\MediaLibrary\Conversion\Conversion), 1)
5 [internal function]: Illuminate\Support\Collection->Illuminate\Support{closure}(Object(Spatie\MediaLibrary\Conversion\Conversion), 1)
6 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Support/Arr.php(611): array_filter(Array, Object(Closure), 1)
7 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Support/Collection.php(549): Illuminate\Support\Arr::where(Array, Object(Closure))
8 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Support/Collection.php(1518): Illuminate\Support\Collection->filter(Object(Closure))
9 /var/www/html/soulmade/vendor/spatie/laravel-medialibrary/src/FileManipulator.php(90): Illuminate\Support\Collection->reject(Object(Closure))
10 /var/www/html/soulmade/vendor/spatie/laravel-medialibrary/src/Jobs/PerformConversions.php(32): Spatie\MediaLibrary\FileManipulator->performConversions(Object(Spatie\MediaLibrary\Conversion\ConversionCollection), Object(Spatie\MediaLibrary\Models\Media))
11 [internal function]: Spatie\MediaLibrary\Jobs\PerformConversions->handle()
12 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)
13 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()
14 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
15 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
16 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)
17 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus{closure}(Object(Spatie\MediaLibrary\Jobs\PerformConversions))
18 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Spatie\MediaLibrary\Jobs\PerformConversions))
19 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
20 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(49): Illuminate\Bus\Dispatcher->dispatchNow(Object(Spatie\MediaLibrary\Jobs\PerformConversions), false)
21 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(88): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
22 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(327): Illuminate\Queue\Jobs\Job->fire()
23 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(277): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
24 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
25 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
26 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
27 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
28 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)
29 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()
30 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
31 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
32 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)
33 /var/www/html/soulmade/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
34 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
35 /var/www/html/soulmade/vendor/symfony/console/Application.php(921): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
36 /var/www/html/soulmade/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
37 /var/www/html/soulmade/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
38 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Console/Application.php(90): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
39 /var/www/html/soulmade/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(133): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
40 /var/www/html/soulmade/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
41 {main}
In non-queued mode everything work fine but slow. Sorry for such a long text but and ideas why is it so?