Public Member Functions | Protected Member Functions | Protected Attributes

helper_image Class Reference

Inheritance diagram for helper_image:
helper_file object

Public Member Functions

 __destruct ()
 upload ($file, array $prm=array())
 view ($file, array $prm=array())
 delete ($file, array $prm=null)
 makePath ($file, $more=null)
 make (array $prm=array())
 valid (array $file, array $prm=array())
 setImg ($file)
 save ($file)
 mask ($file)
 getAttr ($name)
 setAttr ($name, $value)
 getCfg ()

Protected Member Functions

 addFilesRootIfNeeded ($file)
 build ()
 html (array $options=array())
 createImage ($file)
 resize (array $prm=array())
 crop (array $prm)
 hexa2dec ($col)
 beforeInit ()
 afterInit ()

Protected Attributes

 $imgAct
 $imgTmp
 $info
 $cfg

Detailed Description

Helper to manipulate and upload image

Definition at line 10 of file image.class.php.


Constructor & Destructor Documentation

__destruct (  ) 

Destructor

Definition at line 36 of file image.class.php.


Member Function Documentation

addFilesRootIfNeeded ( file  )  [protected]

Add FILESROOT to a filename if not present in it

Parameters:
string $file Filename
Returns:
string Filename

Definition at line 122 of file image.class.php.

beforeInit (  )  [protected, inherited]

Call just before the configuration initialisation

Reimplemented in form_file.

Definition at line 35 of file object.class.php.

build (  )  [protected]

Make an image with the configuration parameter

Returns:
bool|string True if success or HTML string if requested

Definition at line 155 of file image.class.php.

createImage ( file  )  [protected]

Create an image ressource and get the dimension of the

Parameters:
string $file The image path
Returns:
false|array False if not a valid image or an array with Image ressource, width and height

Definition at line 333 of file image.class.php.

crop ( array $  prm  )  [protected]

Crop the image

Parameters:
array $prm The parameter for the cropping:

  • int x: The X position where crop (default: -1 -> automaticly center)
  • int y: The Y position where crop (default: -1 -> automaticly center)
  • int w: The width result (default: 0 -> the source image width)
  • int h: The height result (default: 0 -> the source image height)
Returns:
bool True if success

Definition at line 505 of file image.class.php.

delete ( file,
array $  prm = null 
)

Delete the eventual thumbnail created for an image Used in form_fileUploaded

Parameters:
string $file The image uploaded
array $prm The parameter for the image

Definition at line 92 of file image.class.php.

getAttr ( name  )  [inherited]

Get an attribute

Parameters:
string $name Attribute name
Returns:
mixed|null The attribute or null if not set

Reimplemented in response_proxy.

Definition at line 48 of file object.class.php.

getCfg (  )  [inherited]

Get the configuration object

Returns:
config

Definition at line 67 of file object.class.php.

hexa2dec ( col  )  [protected]

Convert an hexadecimal color to an rgb.

Parameters:
string $col The hexadecimal color
Returns:
array Numeric index (0: R, 1: V and 2: B)

Definition at line 547 of file image.class.php.

html ( array $  options = array()  )  [protected]

Make an image with the configuration parameter

Returns:
string|null The HTML string or null if the image doesn't exists

Definition at line 271 of file image.class.php.

make ( array $  prm = array()  ) 

Make an image

Parameters:
array $prm The parameter for the image
Returns:
bool|string True if success or HTML string if requested
See also:
bluid

Definition at line 135 of file image.class.php.

makePath ( file,
more = null 
)

Make the path for a thumbnail

Parameters:
string $file File name source
string $more To create other
Returns:
string Thumbnail path

Definition at line 104 of file image.class.php.

mask ( file  ) 

Add a mask to the actual image

Parameters:
string $file The mask image path

Definition at line 473 of file image.class.php.

resize ( array $  prm = array()  )  [protected]

Resize the image

Parameters:
array $prm The parameter for the resizing:

  • string imgName: The image ressource to use (default: Act);
  • int w: The width (default: 0 -> proportionnal resize with the height)
  • int h: The height (default: 0 -> proportionnal resize width the width)
  • bool fit: Indicate if the image will be fit to the size (default: true)
  • hexa bgColor: The background color (default: ffffff)
Returns:
bool True if success

Definition at line 371 of file image.class.php.

save ( file  ) 

Save the image

Parameters:
string $file The image path

Definition at line 308 of file image.class.php.

setAttr ( name,
value 
) [inherited]

Set an attribute

Parameters:
string $name Attribute name
mixed $value Attribute value

Reimplemented in response_proxy.

Definition at line 58 of file object.class.php.

setImg ( file  ) 

Set an image and creating a ressource with it

Parameters:
string $file The image path
Returns:
bool Indicate if everything went well or not

Definition at line 290 of file image.class.php.

upload ( file,
array $  prm = array() 
)

Upload an image form a uploaded file Used in form_fileUploaded

Parameters:
string $file The image uploaded
array $prm The parameter for the image
See also:
bluid

Definition at line 51 of file image.class.php.

valid ( array $  file,
array $  prm = array() 
)

Check if the image is valid (to be used by form_fileUploaded)

Parameters:
string $file File pathname
array $prm
Returns:
bool|string True if valid or string representing the error

Reimplemented from helper_file.

Definition at line 140 of file image.class.php.

view ( file,
array $  prm = array() 
)

Get the HTML source to show an image

Parameters:
string $file Filename
array $prm
See also:
helper_mage config
Returns:
string The HTML image tag

Definition at line 67 of file image.class.php.


Field Documentation

$cfg [protected, inherited]

Definition at line 17 of file object.class.php.

$imgAct [protected]

Definition at line 17 of file image.class.php.

$imgTmp [protected]

Definition at line 24 of file image.class.php.

$info [protected]

Definition at line 31 of file image.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations
Generated on Tue May 8 2012 16:02:25 for nyroFwk by doxygen 1.7.1