nyroFwk  0.2
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)
 
 watermark ($prm)
 
 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()

__destruct ( )

Destructor

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

Member Function Documentation

◆ addFilesRootIfNeeded()

addFilesRootIfNeeded (   $file)
protected

Add FILESROOT to a filename if not present in it

Parameters
string$fileFilename
Returns
string Filename

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

◆ afterInit()

afterInit ( )
protectedinherited

Call just after the configuration initialisation

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

◆ beforeInit()

beforeInit ( )
protectedinherited

Call just before the configuration initialisation

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

◆ build()

build ( )
protected

Make an image with the configuration parameter

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

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

◆ createImage()

createImage (   $file)
protected

Create an image ressource and get the dimension of the

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

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

◆ crop()

crop ( array  $prm)
protected

Crop the image

Parameters
array$prmThe 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 618 of file image.class.php.

◆ delete()

delete (   $file,
array  $prm = null 
)

Delete the eventual thumbnail created for an image Used in form_fileUploaded

Parameters
string$fileThe image uploaded
array$prmThe parameter for the image

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

◆ getAttr()

getAttr (   $name)
inherited

Get an attribute

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

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

◆ getCfg()

getCfg ( )
inherited

Get the configuration object

Returns
config

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

◆ hexa2dec()

hexa2dec (   $col)
protected

Convert an hexadecimal color to an rgb.

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

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

◆ html()

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 284 of file image.class.php.

◆ make()

make ( array  $prm = array())

Make an image

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

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

◆ makePath()

makePath (   $file,
  $more = null 
)

Make the path for a thumbnail

Parameters
string$fileFile name source
string$moreTo create other
Returns
string Thumbnail path

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

◆ mask()

mask (   $file)

Add a mask to the actual image

Parameters
string$fileThe mask image path

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

◆ resize()

resize ( array  $prm = array())
protected

Resize the image

Parameters
array$prmThe 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: Indicates if the image will be fit to the size (default: true)
  • bool useMaxResize: Indicates if the image will be resized to only one dimension (default: false)
  • hexa bgColor: The background color (default: ffffff)
Returns
bool True if success

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

◆ save()

save (   $file)

Save the image

Parameters
string$fileThe image path

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

◆ setAttr()

setAttr (   $name,
  $value 
)
inherited

Set an attribute

Parameters
string$nameAttribute name
mixed$valueAttribute value

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

◆ setImg()

setImg (   $file)

Set an image and creating a ressource with it

Parameters
string$fileThe image path
Returns
bool Indicate if everything went well or not

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

◆ upload()

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

Upload an image form a uploaded file Used in form_fileUploaded

Parameters
string$fileThe image uploaded
array$prmThe parameter for the image
See also
bluid

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

◆ valid()

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

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

◆ view()

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

Get the HTML source to show an image

Parameters
string$fileFilename
array$prm
See also
helper_mage config
Returns
string The HTML image tag

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

◆ watermark()

watermark (   $prm)

Add a watermark to the actual image

Parameters
array$prmThe watermark configuration with:
  • string file: The image file path (required)
  • boolean fit: Indicates if the watermark should fit the image size (default: false)
  • boolean center: Indicates if the watermark is center (if not fitted) (default: true)
  • int margin: Margin to place the watermark (default: 0)

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

Field Documentation

◆ $cfg

$cfg
protectedinherited

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

◆ $imgAct

$imgAct
protected

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

◆ $imgTmp

$imgTmp
protected

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

◆ $info

$info
protected

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


The documentation for this class was generated from the following file:
Generated on Sun Oct 15 2017 22:25:21 for nyroFwk by doxygen 1.8.13