Generates paceholder images

author etessore
version 1.0.1
package classes

 Methods

Flush the cache file and regenerate it

flush(bool $check) : \ImageGenerator

Parameters

$check

bool

false only if you don't want to delete the cache file. Useful to pass isset($_REQUEST['refresh']) in the ajax implementation

Returns

\ImageGenerator$this for chainability

Retrieves all the image sizes registered in WordPress

get_all_image_sizes() : array
Static

Returns

arrayof all image sizes registered in WP 'size_name' => array( 'width' => 200, 'height' => 80, 'crop' => true )

Finds width and height of a media size

get_dimensions(string $media_dimensions) : array
Static

Parameters

$media_dimensions

string

the media size

Returns

arrayarray('width'=>'','height'=>'','crop'=>'')

Generates an alternative text for this image

get_image_alt() 

Get the image height

get_image_height() 

Retrieves the image src attribute

get_image_src() 

Gets the image width

get_image_width() 

Retrieves the html markup for the current generated image

get_markup() : \the

Returns

\thehtml markup for the current generated image

Retrieves the rgb value from the given hexadecimal

get_rgb(string $hex) : array
Static

Parameters

$hex

string

the hex representation of the color

Returns

arrayred green and blue values

Hooks into WordPress to serve a generated image when no one is available

hook() 

outputs the raw image with appropriate header.

image() : \ImageGenerator

Returns

\ImageGenerator$this for chainability

Initializes the object by checking if the image exists or has to be generated

init() 

Callback for 'post_thumbnail_html' hook.

post_thumbnail_html_callback(string $html, \unknown_type $post_id, \unknown_type $post_thumbnail_id, \unknown_type $size, \unknown_type $attr) 

Changes the html markup if the post thumbnail is not set

Parameters

$html

string

$post_id

\unknown_type

$post_thumbnail_id

\unknown_type

$size

\unknown_type

$attr

\unknown_type

Sets a parameter for the current generator

set(string $param, string $value) : \ImageGenerator

Parameters

$param

string

the name of the parameter

$value

string

the value of the parameter

Returns

\ImageGenerator$this for chainability

Generates an image

generate_image() : \ImageGenerator

Returns

\ImageGenerator$this for chainability

Saves the image into the upload directory

save_image() : \ImageGenerator

Returns

\ImageGenerator$this for chainability

 Properties

 

stores the settings for this generator

$settings : array
 

some infos about the cache: url\path\filename...

$cache : array
 

an image resource identifier

$image : resource
 

url for the generated image

$url : string