PHP 클래스 BulletProof\Image

상속: implements ArrayAccess
파일 보기 프로젝트 열기: samayo/bulletproof

보호된 프로퍼티들

프로퍼티 타입 설명
$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