PHP Class App\services\UploadsManager

Mostra file Open project: qloog/laravel5-backend Class Usage Examples

Protected Properties

Property Type Description
$disk
$mimeDetect

Public Methods

Method Description
__construct ( Dflydev\ApacheMimeTypes\PhpRepository $mimeDetect )
createDirectory ( $folder ) : string Create a new directory
deleteDirectory ( $folder ) : string Delete a directory
deleteFile ( $path ) : string Delete a file
fileMimeType ( $path ) : null | string Return the mime type
fileModified ( $path ) : Carbon\Carbon Return the last modified time
fileSize ( $path ) Return the file size
fileWebpath ( $path ) : string Return the full web path to a file
folderInfo ( string $folder ) : array Return files and directories within a folder
saveFile ( $path, $content ) : string Save a file
uploadImage ( File $file, integer $width = 1440, null $height = null ) : string 上传图片,返回图片的相对路径

Protected Methods

Method Description
breadcrumbs ( $folder ) : array Return breadcrumbs to current folder
cleanFolder ( $folder ) : string Sanitize the folder name
fileDetails ( $path ) : array Return an array of file details for a file

Method Details

__construct() public method

public __construct ( Dflydev\ApacheMimeTypes\PhpRepository $mimeDetect )
$mimeDetect Dflydev\ApacheMimeTypes\PhpRepository

breadcrumbs() protected method

Return breadcrumbs to current folder
protected breadcrumbs ( $folder ) : array
$folder
return array

cleanFolder() protected method

Sanitize the folder name
protected cleanFolder ( $folder ) : string
$folder
return string

createDirectory() public method

Create a new directory
public createDirectory ( $folder ) : string
$folder
return string

deleteDirectory() public method

Delete a directory
public deleteDirectory ( $folder ) : string
$folder
return string

deleteFile() public method

Delete a file
public deleteFile ( $path ) : string
$path
return string

fileDetails() protected method

Return an array of file details for a file
protected fileDetails ( $path ) : array
$path
return array

fileMimeType() public method

Return the mime type
public fileMimeType ( $path ) : null | string
$path
return null | string

fileModified() public method

Return the last modified time
public fileModified ( $path ) : Carbon\Carbon
$path
return Carbon\Carbon

fileSize() public method

Return the file size
public fileSize ( $path )
$path

fileWebpath() public method

Return the full web path to a file
public fileWebpath ( $path ) : string
$path
return string

folderInfo() public method

Return files and directories within a folder
public folderInfo ( string $folder ) : array
$folder string
return array of [ 'folder' => 'path to current folder', 'folderName' => 'name of just current folder', 'breadCrumbs' => breadcrumb array of [ $path => $foldername ] 'folders' => array of [ $path => $foldername] of each subfolder 'files' => array of file details on each file in folder ]

saveFile() public method

Save a file
public saveFile ( $path, $content ) : string
$path
$content
return string

uploadImage() public method

上传图片,返回图片的相对路径
public uploadImage ( File $file, integer $width = 1440, null $height = null ) : string
$file Symfony\Component\HttpFoundation\File\File
$width integer
$height null
return string

Property Details

$disk protected_oe property

protected $disk

$mimeDetect protected_oe property

protected $mimeDetect