PHP Class Spatie\MediaLibrary\Filesystem

Show file Open project: spatie/laravel-medialibrary Class Usage Examples

Protected Properties

Property Type Description
$config Illuminate\Contracts\Config\Repository
$filesystem Illuminate\Contracts\Filesystem\Factory

Public Methods

Method Description
__construct ( Illuminate\Contracts\Filesystem\Factory $filesystems, Illuminate\Contracts\Config\Repository $config )
add ( string $file, Media $media, string $targetFileName = '' ) * Add a file to the mediaLibrary for the given media.
copyFromMediaLibrary ( Media $media, string $targetFile ) * Copy a file from the medialibrary to the given targetFile.
copyToMediaLibrary ( string $file, Media $media, boolean $conversions = false, string $targetFileName = '' ) * Copy a file to the medialibrary for the given $media.
getConversionDirectory ( Media $media ) : string * Return the directory where all conversions of the given media are stored.
getMediaDirectory ( Media $media, boolean $conversion = false ) : string * Return the directory where all files of the given media are stored.
getRemoteHeadersForFile ( string $file ) : array * Get the headers to be used when copying the given file to a remote filesytem.
removeFiles ( Media $media ) * Remove all files for the given media.
renameFile ( Media $media, string $oldName ) * Rename a file for the given media.

Method Details

__construct() public method

public __construct ( Illuminate\Contracts\Filesystem\Factory $filesystems, Illuminate\Contracts\Config\Repository $config )
$filesystems Illuminate\Contracts\Filesystem\Factory
$config Illuminate\Contracts\Config\Repository

add() public method

* Add a file to the mediaLibrary for the given media.
public add ( string $file, Media $media, string $targetFileName = '' )
$file string
$media Media
$targetFileName string

copyFromMediaLibrary() public method

* Copy a file from the medialibrary to the given targetFile.
public copyFromMediaLibrary ( Media $media, string $targetFile )
$media Media
$targetFile string

copyToMediaLibrary() public method

* Copy a file to the medialibrary for the given $media.
public copyToMediaLibrary ( string $file, Media $media, boolean $conversions = false, string $targetFileName = '' )
$file string
$media Media
$conversions boolean
$targetFileName string

getConversionDirectory() public method

* Return the directory where all conversions of the given media are stored.
public getConversionDirectory ( Media $media ) : string
$media Media
return string

getMediaDirectory() public method

* Return the directory where all files of the given media are stored.
public getMediaDirectory ( Media $media, boolean $conversion = false ) : string
$media Media
$conversion boolean
return string

getRemoteHeadersForFile() public method

* Get the headers to be used when copying the given file to a remote filesytem.
public getRemoteHeadersForFile ( string $file ) : array
$file string
return array

removeFiles() public method

* Remove all files for the given media.
public removeFiles ( Media $media )
$media Media

renameFile() public method

* Rename a file for the given media.
public renameFile ( Media $media, string $oldName )
$media Media
$oldName string

Property Details

$config protected property

protected Repository,Illuminate\Contracts\Config $config
return Illuminate\Contracts\Config\Repository

$filesystem protected property

protected Factory,Illuminate\Contracts\Filesystem $filesystem
return Illuminate\Contracts\Filesystem\Factory