Laravel-medialibrary: registerMediaConversions not working on User model

Created on 16 Dec 2016  路  2Comments  路  Source: spatie/laravel-medialibrary

Problem

I used it on a non User model & now on a User model because I'm storing user pics. I put the

public function registerMediaConversions()
    {
        // Perform a resize on every collection
        $this->addMediaConversion('big')
            ->setManipulations(['w' => 960]);

        $this->addMediaConversion('thumb')
             ->setManipulations(['w' => 368, 'h' => 232])
             ->performOnCollections('images');
    }

Then I upload a avatar to the current user.

$user->addMediaFromRequest('file')->toCollection('avatar');

When I go look in the media directory I don't see conversions directory only the original pic?

I checked and was seeing if the registerMediaConversions was being called by putting dd(); & it was so that's not the problem.

Versions

  • Laravel Homestead
  • PHP 7.0
  • Laravel Framework version 5.3.28

Most helpful comment

By default media conversions are queued. What queue driver are you using?

If you don't want a media conversion being queued set the driver to sync or use nonQueued() in your media conversion.

All 2 comments

By default media conversions are queued. What queue driver are you using?

If you don't want a media conversion being queued set the driver to sync or use nonQueued() in your media conversion.

@freekmurze Thanks for the reply I noticed by using dd($this->mediaConversions); then it said onQueue right before you commented LOL For some reason it was changed to database. My mistake thanks for the quick reply & awesome packages!

Was this page helpful?
0 / 5 - 0 ratings