public function registerMediaConversions(Media $media = null)
    {
        $conversions        = config('assetlibrary.conversions');

        foreach ($conversions as $key => $value) {
            $conversionName = $key;

            $this->addMediaConversion($conversionName)
                ->width($value['width'])
                ->height($value['height'])
                ->keepOriginalImageFormat()
                ->optimize();
        }

        if (config('assetlibrary.allowCropping')) {
            $this->addMediaConversion('cropped')
                ->keepOriginalImageFormat()
                ->optimize();
        }
    }
public function registerMediaConversions(Media $media = null)
    {
        $conversions        = config('assetlibrary.conversions');

        foreach ($conversions as $key => $value) {
            $conversionName = $key;

            $this->addMediaConversion($conversionName)
                ->width($value['width'])
                ->height($value['height'])
                ->keepOriginalImageFormat()
                ->optimize();
        }

        if (config('assetlibrary.allowCropping')) {
            $this->addMediaConversion('cropped')
                ->keepOriginalImageFormat()
                ->optimize();
        }
    }
public function registerMediaConversions ( Media $ media = null ) { $ conversions = config ( 'assetlibrary.conversions' ) ; foreach ( $ conversions as $ key => $ value ) { $ conversionName = $ key ; $ this -> addMediaConversion ( $ conversionName ) -> width ( $ value [ 'width' ] ) -> height ( $ value [ 'height' ] ) -> keepOriginalImageFormat ( ) -> optimize ( ) ; } if ( config ( 'assetlibrary.allowCropping' ) ) { $ this -> addMediaConversion ( 'cropped' ) -> keepOriginalImageFormat ( ) -> optimize ( ) ; } }
Register the conversions that should be performed.

@param Media|null $media
@throws \Spatie\Image\Exceptions\InvalidManipulation
Register the conversions that should be performed .