CaMykS  1.0-20231201
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
CImage Class Reference

Image manipulating object. More...

Public Member Functions

 __construct ($source='')
 
 check_imageManipulationEngine ()
 
 load_image ($source)
 
 save_image ($filename, $type='')
 
 is_loaded ()
 
 update_JPGQuality ($quality=75)
 
 crop ($width, $height, $position='', $bgColor='#FFFFFF')
 
 resize ($width, $height=0, $homothetic=0)
 
 sharp ($gain=40)
 
 blur ($loss=50)
 
 darken ($factor=0)
 
 lighten ($factor=0)
 
 trim ($params=array())
 
 rotate ($params=array())
 

Public Attributes

 $width
 Image current width. More...
 
 $height
 Image current height. More...
 

Private Member Functions

 _gd_load_image ($source)
 
 _gd_save_image ($filename, $type)
 
 _gd_crop ($width, $height, $position, $bgColor)
 
 _gd_resize ($width, $height, $homothetic)
 
 _gd_sharp ($gain)
 
 _gd_blur ($loss)
 
 _gd_darken ($factor)
 
 _gd_lighten ($factor)
 
 _gd_trim ($params)
 
 _gd_rotate ($params)
 
 _gd_getAllocatedColor ($color, $resource=false)
 
 _gd_convolution ($matrix, $divisor=false, $offset=0)
 
 _gd_is_transparencyEnabled ()
 
 _gd_add_transparency ()
 

Private Attributes

 $source
 Image source path. More...
 
 $resource
 Image ressource to manipulate. More...
 
 $loaded = false
 Is image loaded. More...
 
 $engine
 Image editing engine to use. More...
 
 $type
 Image type. More...
 
 $jpgQuality = 75
 JPG Quality value for compression while saving. More...
 
 $transparentReplacement = '0xFFFFFF'
 Replacement color for transparency. More...
 
 $hasTransparency = false
 Indicate if picture has transparency. More...
 

Detailed Description

Image manipulating object.

Engine / Object Library

Author
CaMykS Team camyk.nosp@m.s.co.nosp@m.ntact.nosp@m.@gma.nosp@m.il.co.nosp@m.m
Version
1.0.2.2
Date
Creation: Nov 2011
Modification: Oct 2021
Note
This program is distributed as is - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Todo:

Finalise crop calculation in _gd_rotate method.

Complete method documentation with params details.

CImage class.

Author
CaMykS Team camyk.nosp@m.s.co.nosp@m.ntact.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Constructor & Destructor Documentation

◆ __construct()

CImage::__construct (   $source = '')

Object constructor.

Parameters
string$source
Returns
boolean success

Member Function Documentation

◆ check_imageManipulationEngine()

CImage::check_imageManipulationEngine ( )

Check which image manipulation to use.

Returns
void

◆ load_image()

CImage::load_image (   $source)

Load image resource.

Parameters
string$source
Returns
boolean result

◆ save_image()

CImage::save_image (   $filename,
  $type = '' 
)

Save resource as file.

Parameters
string$filename
string$type
Returns
boolean success

◆ is_loaded()

CImage::is_loaded ( )

Check if image is loaded.

Returns
boolean result

◆ update_JPGQuality()

CImage::update_JPGQuality (   $quality = 75)

Update JPEG Quality value.

Parameters
integer$quality
Returns
void

◆ crop()

CImage::crop (   $width,
  $height,
  $position = '',
  $bgColor = '#FFFFFF' 
)

Crop image.

Parameters
integer$width
integer$height
mixed$position
string$bgColor(#transp for transparent background)
Returns
boolean success

◆ resize()

CImage::resize (   $width,
  $height = 0,
  $homothetic = 0 
)

Resize image.

Parameters
integer$width
integer$height
integer$homothetic(0 : no / 1 : yes, use min value / 2 : yes, use max value)
Returns
boolean success

◆ sharp()

CImage::sharp (   $gain = 40)

Sharp image.

Parameters
integer$gain
Returns
boolean success

◆ blur()

CImage::blur (   $loss = 50)

Blur image.

Parameters
integer$loss
Returns
boolean success

◆ darken()

CImage::darken (   $factor = 0)

Darken image.

Parameters
integer$factor
Returns
boolean success

◆ lighten()

CImage::lighten (   $factor = 0)

Lighten image.

Parameters
integer$factor
Returns
boolean success

◆ trim()

CImage::trim (   $params = array())

Trim image.

Parameters
array$params
Returns
boolean success

◆ rotate()

CImage::rotate (   $params = array())

Rotate image.

Parameters
array$params
Returns
boolean success

◆ _gd_load_image()

CImage::_gd_load_image (   $source)
private

Load image with GD.

Returns
boolean success

◆ _gd_save_image()

CImage::_gd_save_image (   $filename,
  $type 
)
private

Save image with GD.

Parameters
string$filename
string$type
Returns
boolean success

◆ _gd_crop()

CImage::_gd_crop (   $width,
  $height,
  $position,
  $bgColor 
)
private

Crop image with GD.

Parameters
integer$width
integer$height
mixed$position
string$bgColor
Returns
boolean success

◆ _gd_resize()

CImage::_gd_resize (   $width,
  $height,
  $homothetic 
)
private

Resize image with GD.

Parameters
integer$width
integer$height
integer$homothetic
Returns
result success

◆ _gd_sharp()

CImage::_gd_sharp (   $gain)
private

Sharp image with GD.

Parameters
integer$gain
Returns
boolean success

◆ _gd_blur()

CImage::_gd_blur (   $loss)
private

Blur image with GD.

Parameters
integer$loss
Returns
boolean success

◆ _gd_darken()

CImage::_gd_darken (   $factor)
private

Darken image with GD.

Parameters
integer$factor
Returns
boolean success

◆ _gd_lighten()

CImage::_gd_lighten (   $factor)
private

Lighten image with GD.

Parameters
integer$factor
Returns
boolean success

◆ _gd_trim()

CImage::_gd_trim (   $params)
private

Trim image with GD.

Parameters
array$params
Returns
boolean success

◆ _gd_rotate()

CImage::_gd_rotate (   $params)
private

Trim rotate with GD.

Parameters
array$params
Returns
boolean success

◆ _gd_getAllocatedColor()

CImage::_gd_getAllocatedColor (   $color,
  $resource = false 
)
private

Return allocated color for GD.

Parameters
string$color
resource$resource
Returns
resource

◆ _gd_convolution()

CImage::_gd_convolution (   $matrix,
  $divisor = false,
  $offset = 0 
)
private

Execute convolution for GD.

Parameters
array$matrix
float$divisor
float$offset
Returns
boolean success

◆ _gd_is_transparencyEnabled()

CImage::_gd_is_transparencyEnabled ( )
private

Check if picture has transparency enabled

Returns
void

◆ _gd_add_transparency()

CImage::_gd_add_transparency ( )
private

Add transparency support for current picture

Returns
void

Member Data Documentation

◆ $source

string CImage::$source
private

Image source path.

◆ $resource

Ressource CImage::$resource
private

Image ressource to manipulate.

◆ $loaded

boolean CImage::$loaded = false
private

Is image loaded.

◆ $engine

string CImage::$engine
private

Image editing engine to use.

◆ $type

string CImage::$type
private

Image type.

◆ $width

integer CImage::$width

Image current width.

◆ $height

integer CImage::$height

Image current height.

◆ $jpgQuality

integer CImage::$jpgQuality = 75
private

JPG Quality value for compression while saving.

◆ $transparentReplacement

string CImage::$transparentReplacement = '0xFFFFFF'
private

Replacement color for transparency.

◆ $hasTransparency

boolean CImage::$hasTransparency = false
private

Indicate if picture has transparency.


The documentation for this class was generated from the following file: