OPEN SOURCE SOCIAL NETWORK 6.6
Loading...
Searching...
No Matches
OssnFile Class Reference
Inheritance diagram for OssnFile:
OssnEntities OssnDatabase OssnBase OssnSession OssnPhotos

Public Member Functions

 MaxSize ()
 
 getUploadMaxSize ()
 
 setFile ($name)
 
 setPath ($path)
 
 getFileExtension ($file)
 
 allowedFileExtensions ()
 
 getFileUploadError ($code)
 
 showFileUploadError ()
 
 setStore (string $type='local')
 
 getStore ()
 
 setImageDim (int $width, int $height, bool $square=false)
 
 getImageDim ()
 
 writeManifest ($directory, $filename, array $addedToCDN)
 
 addFile ()
 
 getFiles ()
 
 searchFiles (array $params=array())
 
 setExtension (array $extension=array())
 
 setMimeTypes (array $mimtypes=array())
 
 typeAllowed ()
 
 getFile ()
 
 isCDN ()
 
 getManifest ()
 
 getPath ()
 
 isFile ()
 
 deleteFile ()
 
 resetRotation ($filename)
 
 output (string $Mime='')
 
- Public Member Functions inherited from OssnEntities
 add ()
 
 get_entity ()
 
 save ()
 
 get_entities ()
 
 AddedEntityGuid ()
 
 updateEntity ()
 
 deleteByOwnerGuid ($guid, $type)
 
 deleteEntity ($guid='')
 
 searchEntities (array $params=array())
 
 canChange ($user='')
 
 destruct ()
 
- Public Member Functions inherited from OssnDatabase
 __construct ()
 
 Connect ()
 
 insert ($params)
 
 statement ($query)
 
 execute ($values=array())
 
 update ($params=array())
 
 select ($params, $multi='')
 
 fetch ($data=false)
 
 delete ($params)
 
 getLastEntry ()
 
 constructWheres (array $array, $operator="AND")
 
 generateLimit ($data_limit=false, $page_limit=false, $offset=false)
 
 clearVars ()
 
 __destruct ()
 
- Public Member Functions inherited from OssnBase
 getGUID ()
 
 getID ()
 
 getParam ($param)
 
 isParam ($param)
 
 __call ($method, $args)
 

Static Public Member Functions

static DeleteDir ($path)
 
static moveFiles ($from, $to)
 
static mimeTypes ()
 
- Static Public Member Functions inherited from OssnSession
static start ()
 
static assign ($name='', $value='')
 
static unassign ($name='')
 
static isSession ($name='')
 
static getSession ($name='')
 

Member Function Documentation

◆ addFile()

addFile ( )

addFile Add file to database

Parameters
integer$object-,>owner_guidGuid of owner , the file belongs to
string$object-,>typeOwner type,
string$object-,>subtypefile type
Returns
integer|boolean

◆ allowedFileExtensions()

allowedFileExtensions ( )

Allowed file extensions Validate file extension before save

Returns
array|null

◆ DeleteDir()

static DeleteDir (   $path)
static

DeleteDir Delete the directories including files

Parameters
string$pathpath of directory
Returns
boolean

◆ deleteFile()

deleteFile ( )

Delete file

Returns
boolean

◆ getFile()

getFile ( )

Get a file

Returns
boolean|object

◆ getFileExtension()

getFileExtension (   $file)

Get file extension from its name

Parameters
string$fileFull file name
Returns
string|false

◆ getFiles()

getFiles ( )

getFiles Get owner files

Parameters
integer$object-,>owner_guidGuid of owner , the file belongs to
string$object-,>typeOwner type
string$object-,>subtypeFile type
Returns
object

◆ getFileUploadError()

getFileUploadError (   $code)

getFileUploadError Print user friendly file upload error

Parameters
integer$codeError code
Returns
string

◆ getImageDim()

getImageDim ( )

Get Image settings

Returns
boolean|array

◆ getManifest()

getManifest ( )

Get Manifest for CDN file

Returns
array|bool

◆ getPath()

getPath ( )

Get a full file path in data root

Returns
boolean|string

◆ getStore()

getStore ( )

Get store type

Returns
string|bool

◆ getUploadMaxSize()

getUploadMaxSize ( )

UploadMaxSize Get server upload max size in bytes [E] Ossn::File MaxSize() add UploadMaxSize #2148

Returns
integer

◆ isCDN()

isCDN ( )

Check if the file is CDN

Returns
bool

◆ isFile()

isFile ( )

Check if file exists or not

Returns
boolean

◆ MaxSize()

MaxSize ( )

MaxSize Get server post max size size in bytes

Returns
integer

◆ mimeTypes()

static mimeTypes ( )
static

MIME types.

This function contains most commonly used MIME types in Ossn

You can find mimtypes on the url below: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=markup

Extra mimetypes has been removed in Ossn v3.1. You can add a hook to extends mimetypes

Returns
array|null

◆ moveFiles()

static moveFiles (   $from,
  $to 
)
static

moveFiles Move files from one directory to another

Parameters
string$fromComplete directory path from where you want to move files.
string$toComplete directory path where you want to move files.
Returns
boolean

◆ output()

output ( string  $Mime = '')

Output the file to the browser

Parameters
string$MimeMime type
Returns
void

◆ resetRotation()

resetRotation (   $filename)

Fix image rotation #981

Returns
void

◆ searchFiles()

searchFiles ( array  $params = array())

getFiles

Parameters
string$params,['subtype']File type
string$params,['type']user/object/message etc
string$params,['page_limit']Files per page
string$params,['count']true if you want to count only
Returns
array|bool

◆ setExtension()

setExtension ( array  $extension = array())

Set required file extension

Parameters
array$extensionUploaded file extension can be jpg, jpeg
Returns
void

◆ setFile()

setFile (   $name)

setFile Set a required file in memory

Parameters
string$name
Returns
void

◆ setImageDim()

setImageDim ( int  $width,
int  $height,
bool  $square = false 
)

setImageDim Set Image Resolution

Parameters
int$maxwidthThe desired width of the resized image
int$maxheightThe desired height of the resized image
bool$squareIf it is true it will return a croped image based on w&h
Returns
void

◆ setMimeTypes()

setMimeTypes ( array  $mimtypes = array())

Set required file mimetype If not set, it will try to match mimetype with pre-defined mime type

Parameters
array$mimtypesMimetypes that are allowed
Returns
void

◆ setPath()

setPath (   $path)

Set a path for file where it need to upload

Parameters
string$pathPath where file need to save
Returns
void

◆ setStore()

setStore ( string  $type = 'local')

Set upload type

Parameters
string$typeType local/cdn
Returns
void

◆ showFileUploadError()

showFileUploadError ( )

showFileUploadError Show file upload errors

Returns
void

◆ typeAllowed()

typeAllowed ( )

Validate a uploaded file

Make sure the file extension match also check mimetype

Returns
boolean

◆ writeManifest()

writeManifest (   $directory,
  $filename,
array  $addedToCDN 
)

Write a manifest file for CDN based files

This contains the extra attributes like url, procider etc

Parameters
string$directoryDirectory Name
string$filenameFile name
array$addedToCDNA data that need to be added to file
Returns
boolean

The documentation for this class was generated from the following file: