src/FileManipulator.php
public function createDerivedFiles(Media $media, array $only = [], $onlyIfMissing = false)
    {
        $profileCollection = ConversionCollection::createForMedia($media);

        if (! empty($only)) {
            $profileCollection = $profileCollection->filter(function ($collection) use ($only) {
                return in_array($collection->getName(), $only);
            });
        }

        $this->performConversions(
            $profileCollection->getNonQueuedConversions($media->collection_name),
            $media,
            $onlyIfMissing
        );

        $queuedConversions = $profileCollection->getQueuedConversions($media->collection_name);

        if ($queuedConversions->isNotEmpty()) {
            $this->dispatchQueuedConversions($media, $queuedConversions);
        }
    }
public function createDerivedFiles(Media $media, array $only = [], $onlyIfMissing = false)
    {
        $profileCollection = ConversionCollection::createForMedia($media);

        if (! empty($only)) {
            $profileCollection = $profileCollection->filter(function ($collection) use ($only) {
                return in_array($collection->getName(), $only);
            });
        }

        $this->performConversions(
            $profileCollection->getNonQueuedConversions($media->collection_name),
            $media,
            $onlyIfMissing
        );

        $queuedConversions = $profileCollection->getQueuedConversions($media->collection_name);

        if ($queuedConversions->isNotEmpty()) {
            $this->dispatchQueuedConversions($media, $queuedConversions);
        }
    }
public function createDerivedFiles ( Media $ media , array $ only = [ ] , $ onlyIfMissing = false ) { $ profileCollection = ConversionCollection :: createForMedia ( $ media ) ; if ( ! empty ( $ only ) ) { $ profileCollection = $ profileCollection -> filter ( function ( $ collection ) use ( $ only ) { return in_array ( $ collection -> getName ( ) , $ only ) ; } ) ; } $ this -> performConversions ( $ profileCollection -> getNonQueuedConversions ( $ media -> collection_name ) , $ media , $ onlyIfMissing ) ; $ queuedConversions = $ profileCollection -> getQueuedConversions ( $ media -> collection_name ) ; if ( $ queuedConversions -> isNotEmpty ( ) ) { $ this -> dispatchQueuedConversions ( $ media , $ queuedConversions ) ; } }
Create all derived files for the given media.

@param \Spatie\MediaLibrary\Models\Media $media
@param array $only
@param bool $onlyIfMissing
Create all derived files for the given media .