Properties

$cached_directory

$cached_directory : string

Type

string — The current directory the class is being employed

$original_root

$original_root : string

Type

string — The root of the source image

$compressed

$compressed

$src

$src

$created_dir

$created_dir : bool

Type

bool — If the directory containing the compressed images has already been created

$options

$options : array

Type

array — Options set by the user for the class

$pre_memory_limit

$pre_memory_limit : string|int

Type

string|int — The original memory limit set by the server

$original_image_source

$original_image_source

Methods

__construct()

__construct(string $directory, bool $create_new_directory,  $options) : self

The primary constructor function. It sets up the environment and returns the class object

Parameters

string $directory

The base directory in which images are found - will soon be deprecated

bool $create_new_directory

Whether or not to create a new directory - will soon be deprecated

$options

Returns

self —

Returns the class object for contiuance

createDirectory()

createDirectory( $directory_name) : self

Creates the directory in which the cached images will be stored

Parameters

$directory_name

Returns

self —

Returns the class object for contiuance

compress()

compress( $source) : array

Reads the image and in turn compresses, relocations, and returns a cached copy

Parameters

$source

Returns

array —

Information on the newly compressed image, including the new source with modtime query, the height, and the width

outputSource()

outputSource( $source,  $modtime)

Parameters

$source
$modtime

setHeaders()

setHeaders()

getModtime()

getModtime( $file)

Parameters

$file

getFilename()

getFilename(string $file) : string

Returns the filename basename without the extension, path, or URL

Parameters

string $file

The name of the file

Returns

string —

The name of the file sans extension

isURL()

isURL( $source)

Parameters

$source

isInDirectory()

isInDirectory( $source)

Parameters

$source

is404()

is404( $source)

Parameters

$source

show404()

show404()

isLocal()

isLocal(string $src) : bool

Checks if the image is on the server currently being utilized

Parameters

string $src

Returns

bool —

Whether or not the image is local

makeSource()

makeSource(string $dir) : string

Creates an absolute URL based on the current protocol and location of the image on the server

Parameters

string $dir

Returns

string —

The

increaseMemoryLimit()

increaseMemoryLimit()

resetMemoryLimit()

resetMemoryLimit()

getMimeType()

getMimeType( $image)

Parameters

$image

debug()

debug(mixed $a)

A basic debug function for printing output - good if not using unit testing

Parameters

mixed $a

The input variable

release()

release(mixed $a)

Memory management function that releases an object's value

Parameters

mixed $a

Any input that is to be released

throwError()

throwError( $message,  $error)

Parameters

$message
$error