Class Socialveo\Core\library\Filesystem

InheritanceSocialveo\Core\library\Filesystem » Phalcon\Mvc\User\Component
Uses TraitsSocialveo\Core\Translatable

Class Filesystem

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor File Socialveo\Core\library\Filesystem
_t() Gets translations Socialveo\Core\Translatable
addOnCdn() Add file to CDN Socialveo\Core\library\Filesystem
copy() Copy given file Socialveo\Core\library\Filesystem
createDir() Create directory Socialveo\Core\library\Filesystem
createVideoThumbnail() Creates thumbnail for video Socialveo\Core\library\Filesystem
delete() Deletes given file. Socialveo\Core\library\Filesystem
deleteDir() Delete directory Socialveo\Core\library\Filesystem
fixOrientation() Get the exif data of an image file Socialveo\Core\library\Filesystem
getExifData() Get the exif data of an image file Socialveo\Core\library\Filesystem
getFilesystem() Get filesystem object Socialveo\Core\library\Filesystem
getMimetype() Get file mime_type Socialveo\Core\library\Filesystem
getSize() Get file size Socialveo\Core\library\Filesystem
getTimestamp() Get file timestamp Socialveo\Core\library\Filesystem
getVisibility() Get visibility of given file Socialveo\Core\library\Filesystem
getWithMetadata() Get with metadata Socialveo\Core\library\Filesystem
has() Has file Socialveo\Core\library\Filesystem
init() Initialize Filesystem Socialveo\Core\library\Filesystem
initAdapter() Setup local adapter Socialveo\Core\library\Filesystem
initCacheFileSystem() Setup cache filesystem Socialveo\Core\library\Filesystem
initFilesystem() Setup filesystem Socialveo\Core\library\Filesystem
listContents() List contents Socialveo\Core\library\Filesystem
listPaths() List paths - required include a plugin Socialveo\Core\library\Filesystem
listWith() List with metadata - required include a plugin Socialveo\Core\library\Filesystem
move() Move file Socialveo\Core\library\Filesystem
put() Put file Socialveo\Core\library\Filesystem
putStream() Put stream Socialveo\Core\library\Filesystem
read() Read file Socialveo\Core\library\Filesystem
readAndDelete() Read and delete file Socialveo\Core\library\Filesystem
readStream() Read stream Socialveo\Core\library\Filesystem
rename() Read file Socialveo\Core\library\Filesystem
resizeCoverOrAvatar() Resize cover or avatar Socialveo\Core\library\Filesystem
resizeImage() Resize image Socialveo\Core\library\Filesystem
setVisibility() Set file visibility Socialveo\Core\library\Filesystem
t() Gets translations Socialveo\Core\Translatable
update() Update file Socialveo\Core\library\Filesystem
updateStream() Update stream Socialveo\Core\library\Filesystem
write() Write file Socialveo\Core\library\Filesystem
writeStream() Write streams Socialveo\Core\library\Filesystem

Method Details

__construct() public method (available since version 1.0)

Constructor File

Initializes the File library, sets the local (and remote) filesystem

public void __construct ( $init true )
$init boolean

Initialize adapters and filesystem from configuration

addOnCdn() public method (available since version 1.0)

Add file to CDN

public boolean addOnCdn ( $cdn, $filename )
$cdn
$filename string
copy() public method (available since version 1.0)

Copy given file

The copy method provided by the Mount Manager takes the origin of the file into account. When it detects the source and destination are located on a different file systems it’ll use a streamed upload instead, transparently.

public boolean|string copy ( $file, $new )
$file string

Original filename given

$new string

Copied filename given

return boolean|string

True|false or message "File not found at path: %s"

createDir() public method (available since version 1.0)

Create directory

Create directory to given path

public boolean createDir ( $dir, $visibility 'public' )
$dir string

Given directory path

$visibility string
createVideoThumbnail() public method (available since version 1.0)

Creates thumbnail for video

public boolean|string createVideoThumbnail ( $network_uuid, $filename, &$imgType )
$network_uuid string
$filename string
$imgType string
delete() public method (available since version 1.0)

Deletes given file.

If the file type is image also deletes all previously generated sizes

public boolean|string delete ( $file )
$file string

File given

return boolean|string

True|false or message "File not found at path: %s"

deleteDir() public method (available since version 1.0)

Delete directory

Delete given directory

public boolean deleteDir ( $dir )
$dir string

Given directory

return boolean

True when is deleted, false when is not found or not deleted

fixOrientation() public method (available since version 1.0)

Get the exif data of an image file

public boolean fixOrientation ( $filePath )
$filePath string
getExifData() public method (available since version 1.0)

Get the exif data of an image file

public boolean getExifData ( $filePath )
$filePath string
getFilesystem() public method (available since version 1.0)

Get filesystem object

Get flysystem $filesystem object

public \League\Flysystem\Filesystem getFilesystem ( )
return \League\Flysystem\Filesystem

Filesystem object

getMimetype() public method (available since version 1.0)

Get file mime_type

Return mime_type of given file

public mixed getMimetype ( $file )
$file string

File given

getSize() public method (available since version 1.0)

Get file size

Return size of given file

public mixed getSize ( $file )
$file string

File given

getTimestamp() public method (available since version 1.0)

Get file timestamp

Return timestamp of given file

public mixed getTimestamp ( $file )
$file string

File given

getVisibility() public method (available since version 1.0)

Get visibility of given file

Visibility is the abstraction of file permissions across multiple platforms. Visibility can be either public or private.

public string getVisibility ( $file )
$file string

Given file which want get visibility

return string

$visibility public or private or message "File not found at path: %s"

getWithMetadata() public method (available since version 1.0)

Get with metadata

Get file into with explicit metadata

public array|false getWithMetadata ( $file, $metadata = ['timestamp''size''mime_type'] )
$file string

File given which want get metadata

$metadata array

Requested metadata for given file

return array|false

All metadata of given file

has() public method (available since version 1.0)

Has file

Check if a file exists

public boolean has ( $file )
$file string

File given

return boolean

True|false

init() public method

Initialize Filesystem

public void init ( )
initAdapter() public method (available since version 1.0)

Setup local adapter

Setup Flysystem adapter, create new League\Flysystem\Adapter\Local or ReplicateAdapter object

public void initAdapter ( $path, $source false )
$path string

Path where files are stored

$source boolean
initCacheFileSystem() public method (available since version 1.0)

Setup cache filesystem

Setup Flysystem filesystem for caching

public \League\Flysystem\Filesystem initCacheFileSystem ( )
initFilesystem() public method (available since version 1.0)

Setup filesystem

Setup Flysystem filesystem

public void initFilesystem ( $adapter false )
$adapter \League\Flysystem\Adapter\Local|boolean

Adapter used by filesystem

listContents() public method (available since version 1.0)

List contents

The result of a contents listing is a collection of arrays containing all the metadata the file manager knows at that time. By default you’ll receive path info and file type. Additional info could be supplied by default depending on the adapter used.

public array listContents ( $dir '', $recursively false )
$dir string

Optional directory name, by default lists the top directory non-recursively

$recursively boolean

Recursive boolean to get more precise results

return array

$files all file with metadata

listPaths() public method (available since version 1.0)

List paths - required include a plugin

public array listPaths ( )
return array

$paths all paths

listWith() public method (available since version 1.0)

List with metadata - required include a plugin

List with ensured presence of specific metadata

public array listWith ( $metadata, $dir '', $recursively false )
$metadata array

Metadata which want to list, possible ['mimetype', 'size', 'timestamp']

$dir string

Optional directory name, by default lists the top directory non-recursively

$recursively boolean

Recursive boolean to get more precise results

return array

$paths all paths with metadata

move() public method (available since version 1.0)

Move file

The move call is the multi-file system counterpart to rename. Where rename must be used on the same file system, the move call provides the same conceptual behavior, but then on two different file systems.

public boolean|string move ( $file, $new )
$file string

Original filename given

$new string

New file

return boolean|string

True|false or message "File not found at path: %s"

put() public method (available since version 1.0)

Put file

Write or Update given file

public boolean put ( $file, $content )
$file string

File given

$content string

Content given

return boolean

True|false

putStream() public method (available since version 1.0)

Put stream

Create or overwrite using a stream

public void putStream ( $file, $contents )
$file string

File which to put stream

$contents string

Contents to put on stream

read() public method (available since version 1.0)

Read file

Write to given file

public string|false read ( $file )
$file string

File given

return string|false

The file contents or false on failure.

readAndDelete() public method (available since version 1.0)

Read and delete file

Read given file and then delete it

public boolean|string readAndDelete ( $file )
$file string

File given

return boolean|string

True|false or message "File not found at path: %s"

readStream() public method (available since version 1.0)

Read stream

Retrieve a read-stream

public string readStream ( $file )
$file string

File which want to read stream

return string

$contents or message "File not found at path: %s"

rename() public method (available since version 1.0)

Read file

Write to given file

public boolean|string rename ( $file, $new )
$file string

Original filename given

$new string

New filename given

return boolean|string

True|false or message "File not found at path: %s"

resizeCoverOrAvatar() public method (available since version 1.0)

Resize cover or avatar

public boolean resizeCoverOrAvatar ( $network_uuid, $filename, $file_ext, $type )
$network_uuid string
$filename string
$file_ext string
$type string

(cover or avatar)

resizeImage() public method (available since version 1.0)

Resize image

public boolean resizeImage ( $network_uuid, $filename, $file_ext )
$network_uuid string
$filename string
$file_ext string
setVisibility() public method (available since version 1.0)

Set file visibility

Visibility is the abstraction of file permissions across multiple platforms. Visibility can be either public or private.

public boolean setVisibility ( $file, $visibility )
$file string

Given file to set visibility

$visibility string

Public or private

return boolean

True|false true if set, false when file is not found

update() public method (available since version 1.0)

Update file

Update give file with give contents

public boolean update ( $file, $content )
$file string

File given

$content string

Content given

return boolean

True|false or message "File not found at path: %s"

updateStream() public method (available since version 1.0)

Update stream

Update a file with stream contents

public boolean|string updateStream ( $file, $stream )
$file string

File where want add stream

$stream resource

Resource to be updated

return boolean|string

True|false or message with error on fail

write() public method (available since version 1.0)

Write file

This ensures that the directory you’re trying to write exists – if it doesn’t, it creates it for you recursively

public boolean write ( $file, $content, $visibility 'public' )
$file string

File given

$content string

Content given

$visibility string
return boolean

True|false or message "File already exist at path: %s"

writeStream() public method (available since version 1.0)

Write streams

Write streams to give path of give stream

public boolean|string writeStream ( $destination, $resource, $visibility 'public' )
$destination string

Where to write stream

$resource resource

File which want to read stream

$visibility string

[optional]

return boolean|string

True|false or message "File already exist at path: %s"