Spatie\MediaLibrary\Media::getTypeFromExtensionAttribute PHP Method

getTypeFromExtensionAttribute() public method

Determine the type of a file from its file extension.
    public function getTypeFromExtensionAttribute()
    {
        $imageGenerators = $this->getImageGenerators()->map(function (string $className) {
            return app($className);
        });
        foreach ($imageGenerators as $imageGenerator) {
            if ($imageGenerator->canHandleExtension(strtolower($this->extension))) {
                return $imageGenerator->getType();
            }
        }
        return static::TYPE_OTHER;
    }