\AclUser\ServiceRotateAndResizeImageFile

Class that is used to apply users requested changes to the image that they have uploaded as their profile picture

Summary

Methods
Properties
Constants
rotateAndResize()
getErrorMessages()
checkParams()
getSource()
No public properties found
No constants found
rotateImage()
checkFileExists()
getExtension()
$errorMessages
$initialSaveLocation
$finalSavePath
N/A
No private methods found
No private properties found
N/A

Properties

$errorMessages

$errorMessages : array

An array of messages created when something goes wrong with the image manipulation

Type

array

$initialSaveLocation

$initialSaveLocation : string

Location where the initial image has been saved

Type

string

$finalSavePath

$finalSavePath : string

the final path and (file) name where the image will end up

Type

string

Methods

rotateAndResize()

rotateAndResize(array  $params, integer  $userId) : boolean

Rotate, resize image and convert to final image format and save where required

Parameters

array $params

merged post and file parameters

integer $userId

user's id which will be the name of the file on success.

Returns

boolean —

whether the whole procedure was a success

getErrorMessages()

getErrorMessages() : array

Get an array of error message when something goes wrong

Returns

array —

containing error messages

checkParams()

checkParams(array  $params) : boolean

Check whether all the parameters that are required by the class are present

Parameters

array $params

merged post and file parameters

Returns

boolean —

whether all parameters are present

getSource()

getSource(string  $extension) : resource

Get the Returns an image resource identifier.

Parameters

string $extension

Returns

resource —

an image resource identifier on success, FALSE on errors.

rotateImage()

rotateImage(resource  $source, string  $fileName, integer  $rotation, string  $extension) 

Rotate the image and save to new location in rotated folder the remove the original (unrotated) image file

Parameters

resource $source

image resource identifier

string $fileName

the name of the file

integer $rotation

rotation (multiple of 90)

string $extension

the file extension (lowercase)

checkFileExists()

checkFileExists() : boolean

Check whether the file exists on the server

Returns

boolean —

whether the file exists

getExtension()

getExtension(string  $fileName) : string|false

Get the extension (lowercase) or false if it is not supported

Parameters

string $fileName

the name of the file

Returns

string|false —

if the extension is not supported