PHP Класс BulletProof\Image

Наследование: implements ArrayAccess
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$dimensions The max height and width image allowed
$fullPath The full image path (dir + image + mime)
$height The image height in pixels
$imageMimes list of known image types
$location The folder or image storage location
$mime The image mime type (extension)
$mimeTypes The mime types allowed for upload
$name The new image name, to be provided or will be generated.
$serialize A json format of all information about an image
$size The min and max image size allowed for upload (in bytes)
$width The image width in pixels

Открытые методы

Метод Описание
__construct ( array $_files = [] )
getError ( ) : string | boolean Returns error string or false if no errors occurred
getFullPath ( ) : string Returns the full path of the image ex "location/image.mime"
getHeight ( ) : integer Returns the image height in pixels
getJson ( ) : string Returns a JSON format of the image width, height, name, mime .
getLocation ( ) : string Returns the storage / folder name
getMime ( ) : string Returns the image mime type
getName ( ) : string Returns the image name
getSize ( ) : integer Returns the image size in bytes
getWidth ( ) : integer Returns the image width
moveUploadedFile ( $tmp_name, $destination ) : boolean Final upload method to be called, isolated for testing purposes
offsetExists ( $offset )
offsetGet ( mixed $offset ) : boolean | mixed Gets array value \ArrayAccess
offsetSet ( $offset, $value ) array offset \ArrayAccess unused
offsetUnset ( $offset )
setDimension ( $maxWidth, $maxHeight ) Sets acceptable max image height and width
setLocation ( $dir = "bulletproof", integer $permission = 438 ) Creates a location for upload storage
setMime ( array $fileTypes ) Define a mime type for uploading
setName ( $isNameProvided = null ) Renames image
setSize ( $min, $max ) Define a min and max image size for uploading
upload ( ) Main upload method.

Защищенные методы

Метод Описание
getImageMime ( $tmp_name ) : boolean | string Gets the real image mime type
uploadErrors ( $e ) Checks for the common upload errors

Описание методов

__construct() публичный Метод

public __construct ( array $_files = [] )
$_files array represents the $_FILES array passed as dependancy

getError() публичный Метод

Returns error string or false if no errors occurred
public getError ( ) : string | boolean
Результат string | boolean

getFullPath() публичный Метод

Returns the full path of the image ex "location/image.mime"
public getFullPath ( ) : string
Результат string

getHeight() публичный Метод

Returns the image height in pixels
public getHeight ( ) : integer
Результат integer

getImageMime() защищенный Метод

Gets the real image mime type
protected getImageMime ( $tmp_name ) : boolean | string
$tmp_name string The upload tmp directory
Результат boolean | string

getJson() публичный Метод

..
public getJson ( ) : string
Результат string

getLocation() публичный Метод

Returns the storage / folder name
public getLocation ( ) : string
Результат string

getMime() публичный Метод

Returns the image mime type
public getMime ( ) : string
Результат string

getName() публичный Метод

Returns the image name
public getName ( ) : string
Результат string

getSize() публичный Метод

Returns the image size in bytes
public getSize ( ) : integer
Результат integer

getWidth() публичный Метод

Returns the image width
public getWidth ( ) : integer
Результат integer

moveUploadedFile() публичный Метод

Final upload method to be called, isolated for testing purposes
public moveUploadedFile ( $tmp_name, $destination ) : boolean
$tmp_name int the temporary location of the image file
$destination int upload destination
Результат boolean

offsetExists() публичный Метод

public offsetExists ( $offset )

offsetGet() публичный Метод

Gets array value \ArrayAccess
public offsetGet ( mixed $offset ) : boolean | mixed
$offset mixed
Результат boolean | mixed

offsetSet() публичный Метод

array offset \ArrayAccess unused
public offsetSet ( $offset, $value )

offsetUnset() публичный Метод

public offsetUnset ( $offset )

setDimension() публичный Метод

Sets acceptable max image height and width
public setDimension ( $maxWidth, $maxHeight )
$maxWidth int max width value
$maxHeight int max height value

setLocation() публичный Метод

Creates a location for upload storage
public setLocation ( $dir = "bulletproof", integer $permission = 438 )
$dir string the folder name to create
$permission integer chmod permission

setMime() публичный Метод

Define a mime type for uploading
public setMime ( array $fileTypes )
$fileTypes array

setName() публичный Метод

Renames image
public setName ( $isNameProvided = null )

setSize() публичный Метод

Define a min and max image size for uploading
public setSize ( $min, $max )
$min int minimum value in bytes
$max int maximum value in bytes

upload() публичный Метод

This is where all the monkey business happens
public upload ( )

uploadErrors() защищенный Метод

Checks for the common upload errors
protected uploadErrors ( $e )
$e int error constant

Описание свойств

$dimensions защищенное свойство

The max height and width image allowed
protected $dimensions

$fullPath защищенное свойство

The full image path (dir + image + mime)
protected $fullPath

$height защищенное свойство

The image height in pixels
protected $height

$imageMimes защищенное свойство

list of known image types
protected $imageMimes

$location защищенное свойство

The folder or image storage location
protected $location

$mime защищенное свойство

The image mime type (extension)
protected $mime

$mimeTypes защищенное свойство

The mime types allowed for upload
protected $mimeTypes

$name защищенное свойство

The new image name, to be provided or will be generated.
protected $name

$serialize защищенное свойство

A json format of all information about an image
protected $serialize

$size защищенное свойство

The min and max image size allowed for upload (in bytes)
protected $size

$width защищенное свойство

The image width in pixels
protected $width