imageManager ->make($source) ->resize( $config['max_width'] ?? self::DEFAULT_MAX_WIDTH, null, static function (Constraint $constraint): void { $constraint->upsize(); $constraint->aspectRatio(); } ); if (isset($config['blur'])) { $img->blur($config['blur']); } try { $img->save($destination, $config['quality'] ?? self::DEFAULT_QUALITY, 'webp'); } catch (NotSupportedException) { $img->save($destination, $config['quality'] ?? self::DEFAULT_QUALITY); } } }