public function getFileContent($fileName, $contentType, $ext)
    {
        if (Storage::disk(config('cms.storage-location', 'local'))->exists($fileName)) {
            $fileContent = Storage::disk(config('cms.storage-location', 'local'))->get($fileName);
        } elseif (!is_null(config('filesystems.cloud.key'))) {
            $fileContent = Storage::disk('cloud')->get($fileName);
        } else {
            $fileContent = file_get_contents($this->generateImage('File Not Found'));
        }

        if (stristr($fileName, 'image') || stristr($contentType, 'image')) {
            if (! is_null(config('cms.preview-image-size'))) {
                $img = Image::make($fileContent);
                $img->resize(config('cms.preview-image-size', 800), null, function ($constraint) {
                    $constraint->aspectRatio();
                });

                return $img->encode($ext);
            }
        }

        return $fileContent;
    }
public function getFileContent($fileName, $contentType, $ext)
    {
        if (Storage::disk(config('cms.storage-location', 'local'))->exists($fileName)) {
            $fileContent = Storage::disk(config('cms.storage-location', 'local'))->get($fileName);
        } elseif (!is_null(config('filesystems.cloud.key'))) {
            $fileContent = Storage::disk('cloud')->get($fileName);
        } else {
            $fileContent = file_get_contents($this->generateImage('File Not Found'));
        }

        if (stristr($fileName, 'image') || stristr($contentType, 'image')) {
            if (! is_null(config('cms.preview-image-size'))) {
                $img = Image::make($fileContent);
                $img->resize(config('cms.preview-image-size', 800), null, function ($constraint) {
                    $constraint->aspectRatio();
                });

                return $img->encode($ext);
            }
        }

        return $fileContent;
    }
public function getFileContent ( $ fileName , $ contentType , $ ext ) { if ( Storage :: disk ( config ( 'cms.storage-location' , 'local' ) ) -> exists ( $ fileName ) ) { $ fileContent = Storage :: disk ( config ( 'cms.storage-location' , 'local' ) ) -> get ( $ fileName ) ; } elseif ( ! is_null ( config ( 'filesystems.cloud.key' ) ) ) { $ fileContent = Storage :: disk ( 'cloud' ) -> get ( $ fileName ) ; } else { $ fileContent = file_get_contents ( $ this -> generateImage ( 'File Not Found' ) ) ; } if ( stristr ( $ fileName , 'image' ) || stristr ( $ contentType , 'image' ) ) { if ( ! is_null ( config ( 'cms.preview-image-size' ) ) ) { $ img = Image :: make ( $ fileContent ) ; $ img -> resize ( config ( 'cms.preview-image-size' , 800 ) , null , function ( $ constraint ) { $ constraint -> aspectRatio ( ) ; } ) ; return $ img -> encode ( $ ext ) ; } } return $ fileContent ; }
Get a files content

@param  string $fileName
@param  string $contentType
@param  string $ext

@return mixed
Get a files content