PVImage is a class for handling the processing and format of all image files.
PVImage has various functions built into it such as adding watermarks, resizing, cropping and more. By default, the class will use Imagick but can be set to use other image processing tools.
package |
media |
---|
__callStatic(string $method, mixed $args = array()) : mixed
access |
public |
---|
string
The key/name assigned to the method when added
mixed
Arguements to pass to the annoymous function. The function is called using call_user_func_array.
mixed
$value The value returned is the value the stored function returns
_applyFilter(string $class, string $method, mixed $data, array $options = array()) : mixed
access |
protected |
---|
string
The name of the class the filter is in
string
The method the filter is in
mixed
The data that is being passed to the filter
array
options to be passed to the filter. Passed options we be passed to the function. -'default_return' mixed: If no filter is return, the data passed in by default will be return. Can be overriden -'event' string: An event to associate with the filter. Default is null
mixed
$data The data the function returns
_callAdapter(string $class, string $method) : mixed
access |
protected |
---|
string
The name of the class the adapter is in
string
THe name of the method the class is being called from.
mixed
$value A value that the adapter returns
_hasAdapter( $class, string $method) : \boolea
access |
protected |
---|
string
The associated method
\boolea
$hasAdapter Returns true if it has an adapter or false if it doesn not
_hasFilter(string $class, string $method)
string
The class the filter is in
string
The method of the class that the filter is in
_invokeMethod(string $class, string $method, array $args) : mixed
access |
protected |
---|
string
The name of the class to be called
string
The name of the method in the class to be called
array
An array of arguements. Arguements have to be embedded in an array to be called.
mixed
$data Data returned by the function called
_invokeStaticMethod(string $class, string $method, array $args) : mixed
access |
protected |
---|
string
The name of the class to be called
string
The name of the method in the class to be called
array
An array of arguements. Arguements have to be embedded in an array to be called.
mixed
$data Data returned by the function called
_logAdapter(array $data) : void
access |
private |
---|
array
The data in the adapter
_logFilter(array $data) : void
access |
private |
---|
array
The data in the filter
_logObserver(array $data) : void
access |
private |
---|
array
The data in the observer
_notify(string $event) : void
access |
protected |
---|
string
The name of the even that occured that will trigger notifies
_prepareLogData(array $data) : string
access |
private |
---|
array
string
$message JSON encode message of information about the data
addAdapter(string $trigger_class, string $trigger_method, string $call_class, array $options = array()) : void
access |
public |
---|---|
todo |
add ability to adapt singleton class |
string
The class that contains the function the adapter will respond too
string
The method called that will have the adapter to be called.
string
The new class to be called that has the same method name
array
An array of options that be called -'object' string : Assumes that default method in the class to be called is static. If called object needs to be instantiated, change to object to 'instance' and one will be created before the adapter calls the function -'call_method' string: By default the method to be called to override the current one should be the same name. But this can be ovveridden to call a different method. -'type' string: The type of method being called. Default is class_method but if the method is a closure, set the type to be 'closure' and make the $trigger_method the closure
addClassAdapter(mixed $trigger_class, string $call_class, array $options = array()) : void
access |
public |
---|---|
todo |
Add ability to use singleton classes |
mixed
This can either be the name of the class or an object whose methods will be adapted to another class. The class should be included or be autoloaded by this point.
string
The call class is the classes methods that will be called in place of the methods in the trigger_class. These class does not have to be included as this point.
array
Options that be used to further distinguish the behavior of the adapters added -'object' string: Determines if the object being adapted to is static or an instance.Default is static -'call_class' string: The name of the class that the methods will be adapted too. -'class' string: The name of the whose methods will be adapted to another class
addFilter(string $class, string $method, string $filter_class, string $filter_method, array $options = array()) : void
access |
public |
---|
string
The name of the class the filter is going in
string
The name of the method the filter is in
string
The class that the filter resides in.
string
The method in the class that the parameters will be passed too.
array
Options that can be set for further modifying the filter. -'object' string: If the method being called is static, static should be inserted. If its in an instance, 'instance' should be set. Default is set to static. -'event' string: Associate this filter with an event. -'type' string: The type of function being called. Default is class_method but if the function is a closure, set the type to be 'closure' and make the $filter_method the closure
addMethod(string $method, \function $closure) : void
access |
public |
---|
string
The key/value that will be used to call the function
\function
The anonymous function/closure to be added
addObserver(string $event, string $class, string $method, array $options = array()) : void
access |
public |
---|
string
The name of the event that will cause a certain class and method to fire
string
The name of the class that contains the function that will be fired for this event
string
The name of the method that will be fired when the event occurs
array
Options to further the define the firing of an event -'object' string : If the method being called is static, should be set to static. Else set to instance -'class' stinrg : The name of the class to be called. Default is the class that is passed in. -'method' string: The name of the method to be called. Default is the method that is passed in. -'type' string: The type of function being called. Default is class_method but if the function is a closure, set the type to be 'closure' and make the $method the closure
addToCollection(mixed $data) : void
access |
public |
---|
mixed
Any data type( Object, Array, int, etc) to add to the public data collection
addToCollectionWithName(string $name, mixed $data) : void
access |
public |
---|---|
todo |
check the relevance of get and set |
string
The key/index to assign the value to
mixed
Data to be stored in the collection
animateImage(array $data, array $options = array()) : \$mixed
access |
public |
---|---|
todo |
add GD support |
array
The day is the array of images to be passed in. The data at each index can either be a blog/bytes, location to a file, or an imagick object with animage
array
Options that control the animating of images -'converter' string: The default converter set by the init function -'write_image' boolean: Write the image out to file. Default is true. -'write_image_location' string: The location to save the image. Default is the save location set in the init -'write_image_name' string: A name to save the image as. Default is a random string. -'add_extension' boolean: Add a file extension to the write_image_name. Default is true. -'return' string: Specifiy to return an object or file location. Default is set in the init() -'format' string: The format to save the image in. Default is gif. -'image_delay' integer: The delay between the images, default is 30 -'image_width' integer: The width of the images -'image_height' integer: The height of the images
\$mixed
$value The value return is set by the option. Either the location to the file is return or the object for creating the image.
animateText(array $data, array $options = array()) : mixed
access |
public |
---|---|
todo |
add GD support |
array
The array of strings. Each index in the array should be a different string
array
An array of options that can determine how the string will be animated -'converter' string: The default converter set by the init function. -'write_image' boolean: Write the image out to file. Default is true. -'write_image_location' string: The location to save the image. Default is the save location set in the init -'write_image_name' string: A name to save the image as. Default is a random string. -'display_image' boolean: Determines if the image is to be displayed automatically in a header. Default is false. -'add_extension' boolean: Add a file extension to the write_image_name. Default is true. -'return' string: Specifiy to return an object or file location. Default is set in the init() -'format' string: The format to save the image in. Default is gif. -'image_delay' integer: The delay between the images, default is 30 -'image_width' integer: The width of the images -'image_height' integer: The height of the images -'font' string: The font to be used when writing text. Defaultis Helvetica -'font_size' int: The size of the font to be used. Default is 20 -'font_color' string: The color of the font. Default is black. -'font_style' int: The style of the font. Default is Imagick::Style_Normal -'fill_alpha' _double: The number between 0 and 1 on how transparent the text is. Default is 1. -'position_x' int: The starting position of the text on the x-coordinate. Default is 0. -'position_y' int: The starting position of the text on the y-coordinate. Default is 0. -'rotation' int: The number of degress to rotate the text. Default is 0. -'gravity' int: The imagick defined constant on the gravity of the text. Default is Imagick::GRAVITY_CENTER -'pixel_color' string: Serves as the background color the text will be placed on. Default is white
mixed
$return The data to be return. Return is set in the options
clearFilters(string $class, string $method) : void
access |
public |
---|
string
The class the filter is in
string
The method of the class that the filter is in
clearObservers(string $event) : void
access |
public |
---|
string
The event to remove all the observers from
convertImageFormat(mixed $image, string $format, array $options = array()) : \$mixed
access |
public |
---|---|
todo |
add GD support |
mixed
The image can either be the location of an image on a server or a bytes of an image. If the passed variable is bytes, remember to set the option type to 'blob'
string
The format to change the image into. The most common are png, gif and jpeg.
array
Options that can alter the conversion process -'converter' string: The default converter set by the init function -'write_image' boolean: Write the image out to file. Default is true. -'write_image_location' string: The location to save the image. Default is the save location set in the init -'write_image_name' string: A name to save the image as. Default is a random string. -'add_extension' boolean: Add a file extension to the write_image_name. Default is true. -'return' string: Specifiy to return an object or file location. Default is set in the init() -'format' string: The format to save the image in. Default is gif.
\$mixed
$value The value return is set by the option. Either the location to the file is return or the object for creating the image.
cropImage(string $src, string $output, double $width, double $height) : void
todo |
redo and finish, output is never being called |
---|
string
The name and location of the file to crop
string
The location to output the new file
double
The width of the file
double
The hieght of the file
drawDropShadow(mixed $image, array $options = array()) : mixed
access |
public |
---|---|
todo |
add GD support |
mixed
The value passed in can either be the location on a file system or the images in bytes. If the image is bytes, the options 'type' = blob my be set.
array
Options that can be used for further configuring the dropshadow -'converter' string: The default converter set by the init function. -'write_image' boolean: Write the image out to file. Default is true. -'write_image_location' string: The location to save the image. Default is the save location set in the init -'write_image_name' string: A name to save the image as. Default is a random string. -'display_image' boolean: Determines if the image is to be displayed automatically in a header. Default is false. -'add_extension' boolean: Add a file extension to the write_image_name. Default is true. -'return' string: Specifiy to return an object or file location. Default is set in the init() -'format' string: The format to save the image in. Default is png. -'offest_x' int: The offset on the x_coordinate when placing the drop shadow. Default is 0 -'offeset_y' int: The offset on the y_coordinate when placing the drop shadow. Default is 0. -'radius_x' int: Default is width/2 -'radius_y' int: Default height /2
mixed
$return The data to be returned. The type of data that is returned is set in the options
drawEllipse(double $width, double $height, string $color, array $options = array()) : mixed
access |
public |
---|---|
todo |
add GD support |
double
The width of the ellipse
double
The height of the ellipse
string
The color of the ellipse
array
Options that can be used for further configuring the ellipse -'converter' string: The default converter set by the init function. -'write_image' boolean: Write the image out to file. Default is true. -'write_image_location' string: The location to save the image. Default is the save location set in the init -'write_image_name' string: A name to save the image as. Default is a random string. -'display_image' boolean: Determines if the image is to be displayed automatically in a header. Default is false. -'add_extension' boolean: Add a file extension to the write_image_name. Default is true. -'return' string: Specifiy to return an object or file location. Default is set in the init() -'format' string: The format to save the image in. Default is png. -'offest_x' int: The offset on the x_coordinate when drawing the ellipse. Default is the width/2 -'offeset_y' int: The offset on the y_coordinate when drawign the ellipse. Default is height/2 -'radius_x' int: Default is width/2 -'radius_y' int: Default height /2
mixed
$return The data to be returned. The type of data that is returned is set in the options
drawImage(integer $width, integer $height, string $color, array $options = array()) : mixed
access |
public |
---|---|
todo |
add GD support |
integer
The width of the image
integer
The height of the image
string
The color of the image
array
Options that can be used to configure the drawing of the shape -'converter' string: The default converter set by the init function. -'write_image' boolean: Write the image out to file. Default is true. -'write_image_location' string: The location to save the image. Default is the save location set in the init -'write_image_name' string: A name to save the image as. Default is a random string. -'display_image' boolean: Determines if the image is to be displayed automatically in a header. Default is false. -'add_extension' boolean: Add a file extension to the write_image_name. Default is true. -'return' string: Specifiy to return an object or file location. Default is set in the init() -'format' string: The format to save the image in. Default is png.
mixed
$return The data to be returned. The type of data that is returned is set in the options
get(string $index) : mixed
access |
public |
---|
string
The index to retrieve a value from
mixed
$data The data that was stored at that index
getImageHeight(string $image, array $options = array()) : integer
access |
public |
---|---|
todo |
add GD support |
string
The location of the image
array
integer
$height The height of the image
getImageWidth(string $image, array $options = array()) : integer
access |
public |
---|---|
todo |
implement with GD functions |
string
The location of the image
array
integer
$width The width of the image
getInstance() : object
access |
public |
---|---|
object
$instance Returns the instance of a class.
getIterator() : \PVIterator
init( $config = array()) : void
access |
public |
---|
removeAdapter( $class, string $method) : void
access |
public |
---|
string
The associated method
removeClassAdapter( $class) : void
access |
public |
---|
resizeImageGD(string $name, string $filename, double $new_w = 150, double $new_h = 150) : void
todo |
revisit implementation |
---|
string
The location and name of the file
string
The name an location of the new file
double
The new width to resize too
double
The new height to resize too
scaleImage(mixed $image, double $width, double $height, array $options = array()) : \$mixed
access |
public |
---|---|
todo |
add GD support |
mixed
Either pass the location of the file on a server or the image as bytes. If the image is passed as bytes, set the options type to 'blob'
double
The width to scale the image too
double
The height to scale the image too.
array
Options that control the animating of images -'converter' string: The default converter set by the init function -'write_image' boolean: Write the image out to file. Default is true. -'write_image_location' string: The location to save the image. Default is the save location set in the init -'write_image_name' string: A name to save the image as. Default is a random string. -'add_extension' boolean: Add a file extension to the write_image_name. Default is true. -'return' string: Specifiy to return an object or file location. Default is set in the init() -'format' string: The format to save the image in. Default is gif. -'bestfit' boolean: Scales image to the best fit. Default is false.
\$mixed
$value The value return is set by the option. Either the location to the file is return or the object for creating the image.
set(string $index, mixed $value) : void
access |
public |
---|
string
The key or index to store the value at
mixed
A mixed value that can be anytype
setAdapterTrace(boolean $trace = false) : void
access |
public |
---|
boolean
Default is false. If set to true, will trace adatper.
setFilterTrace(boolean $trace = false) : void
access |
public |
---|
boolean
Default is false. If set to true, will trace filter.
setObserverTrace(boolean $trace = false) : void
access |
public |
---|
boolean
Default is false. If set to true, will trace observer.
textToImage(array $string, array $options) : mixed
access |
public |
---|---|
todo |
add GD support |
array
The string to be converted into an image
array
An array of options that can determine how the string will be animated -'converter' string: The default converter set by the init function. -'write_image' boolean: Write the image out to file. Default is true. -'write_image_location' string: The location to save the image. Default is the save location set in the init -'write_image_name' string: A name to save the image as. Default is a random string. -'display_image' boolean: Determines if the image is to be displayed automatically in a header. Default is false. -'add_extension' boolean: Add a file extension to the write_image_name. Default is true. -'return' string: Specifiy to return an object or file location. Default is set in the init() -'format' string: The format to save the image in. Default is gif. -'image_delay' integer: The delay between the images, default is 30 -'image_width' integer: The width of the images -'image_height' integer: The height of the images -'font' string: The font to be used when writing text. Defaultis Helvetica -'font_size' int: The size of the font to be used. Default is 20 -'font_color' string: The color of the font. Default is black. -'font_style' int: The style of the font. Default is Imagick::Style_Normal -'fill_alpha' _double: The number between 0 and 1 on how transparent the text is. Default is 1. -'position_x' int: The starting position of the text on the x-coordinate. Default is 0. -'position_y' int: The starting position of the text on the y-coordinate. Default is 0. -'rotation' int: The number of degress to rotate the text. Default is 0. -'gravity' int: The imagick defined constant on the gravity of the text. Default is Imagick::GRAVITY_CENTER -'pixel_color' string: Serves as the background color the text will be placed on. Default is white
mixed
$return The data to be returned. The type of data that is returned is set in the options
watermarkImageWithImage(mixed $image, string $watermark, array $options = array()) : mixed
access |
public |
---|---|
todo |
add GD support |
mixed
The value passed in can either be the location on a file system or the images in bytes. If the image is bytes, the options 'type' = blob my be set.
string
The location of the image or base the image in as a blob
array
Options that can be used for further configuring the dropshadow -'converter' string: The default converter set by the init function. -'write_image' boolean: Write the image out to file. Default is true. -'write_image_location' string: The location to save the image. Default is the save location set in the init -'write_image_name' string: A name to save the image as. Default is a random string. -'display_image' boolean: Determines if the image is to be displayed automatically in a header. Default is false. -'add_extension' boolean: Add a file extension to the write_image_name. Default is true. -'return' string: Specifiy to return an object or file location. Default is set in the init() -'format' string: The format to save the image in. Default is png. -'type' string: The format the image is in before manipulation. If a blob fo byties is being passed set type to 'blob', otherwise type will be file. -'offest_x' int: The offset on the x_coordinate when placing the drop shadow. Default is 0 -'offeset_y' int: The offset on the y_coordinate when placing the drop shadow. Default is 0.
mixed
$return The data to be returned. The type of data that is returned is set in the options
watermarkImageWithText(mixed $image, string $watermark, array $options = array()) : mixed
access |
public |
---|---|
todo |
add GD support |
mixed
The value passed in can either be the location on a file system or the images in bytes. If the image is bytes, the options 'type' = blob my be set.
string
The the text to add as a watermark
array
Options that can be used for further configuring the dropshadow -'converter' string: The default converter set by the init function. -'write_image' boolean: Write the image out to file. Default is true. -'write_image_location' string: The location to save the image. Default is the save location set in the init -'write_image_name' string: A name to save the image as. Default is a random string. -'display_image' boolean: Determines if the image is to be displayed automatically in a header. Default is false. -'add_extension' boolean: Add a file extension to the write_image_name. Default is true. -'return' string: Specifiy to return an object or file location. Default is set in the init() -'format' string: The format to save the image in. Default is png. -'type' string: The format the image is in before manipulation. If a blob fo byties is being passed set type to 'blob', otherwise type will be file.
mixed
$return The data to be returned. The type of data that is returned is set in the options
_converter :
_write_image :
_write_image_location :
_display_image :
_add_extension :
_return :
_collection :
_methods :
_adapters :
_observers :
_instances :
_filters :
_traceAdapters :
_traceFilters :
_traceObservers :