Class CI_Image_lib - echiong/testRepo GitHub Wiki
##Class CI_Image_lib
Image Manipulation class
Package: [[CodeIgniter<a href="Package CodeIgniter.Libraries.md">Libraries]]
Category:
Image_lib
Author:
ExpressionEngine Dev Team
Link:
http://codeigniter.com/user_guide/libraries/image_lib.html
Located at system/libraries/Image_lib.php
##Methods summary
public __construct ( string $props = array() )
Constructor
Parameters
$props
string
public clear ( )
Initialize image properties
Resets values in case this class is used in a loop
public boolean initialize ( array $props = array() )
initialize image preferences
Parameters
$props
array
Returns
boolean
public boolean resize ( )
Image Resize
This is a wrapper function that chooses the proper resize function based on the protocol specified
Returns
boolean
public boolean crop ( )
Image Crop
This is a wrapper function that chooses the proper cropping function based on the protocol specified
Returns
boolean
public boolean rotate ( )
Image Rotate
This is a wrapper function that chooses the proper rotation function based on the protocol specified
Returns
boolean
public boolean image_process_gd ( string $action = 'resize' )
Image Process Using GD/GD2
This function will resize or crop
Parameters
$action
string
Returns
boolean
public boolean image_process_imagemagick ( string $action = 'resize' )
Image Process Using ImageMagick
This function will resize, crop or rotate
Parameters
$action
string
Returns
boolean
public boolean image_process_netpbm ( string $action = 'resize' )
Image Process Using NetPBM
This function will resize, crop or rotate
Parameters
$action
string
Returns
boolean
public boolean image_rotate_gd ( )
Image Rotate Using GD
Returns
boolean
public boolean image_mirror_gd ( )
Create Mirror Image using GD
This function will flip horizontal or vertical
Returns
boolean
public boolean watermark ( )
Image Watermark
This is a wrapper function that chooses the type of watermarking based on the specified preference.
Returns
boolean
public boolean overlay_watermark ( )
Watermark - Graphic Version
Returns
boolean
public boolean text_watermark ( )
Watermark - Text Version
Returns
boolean
public resource image_create_gd ( string $path = '', mixed $image_type = '' )
Create Image - GD
This simply creates an image resource handle based on the type of image being processed
Parameters
$path
string
$image_type
Returns
resource
public boolean image_save_gd ( resource $resource )
Write image file to disk - GD
Takes an image resource as input and writes the file to the specified destination
Parameters
$resource
resource
Returns
boolean
public image_display_gd ( resource $resource )
Dynamically outputs an image
Parameters
$resource
resource
public image_reproportion ( )
Re-proportion Image Width/Height
When creating thumbs, the desired width/height can end up warping the image due to an incorrect ratio between the full-sized image and the thumb.
This function lets us re-proportion the width/height if users choose to maintain the aspect ratio when resizing.
public mixed get_image_properties ( string $path = '', mixed $return = FALSE )
Get image properties
A helper function that gets info about the file
Parameters
$path
string
$return
Returns
mixed
public array size_calculator ( array $vals )
Size calculator
This function takes a known width x height and recalculates it to a new size. Only one new variable needs to be known
$props = array( 'width' => $width, 'height' => $height, 'new_width' => 40, 'new_height' => '' );
Parameters
$vals
array
Returns
array
public array explode_name ( array $source_image )
Explode source_image
This is a helper function that extracts the extension from the source_image. This function lets us deal with source_images with multiple periods, like: my.cool.jpg It returns an associative array with two elements: $array['ext'] = '.jpg'; $array['name'] = 'my.cool';
Parameters
$source_image
array
Returns
array
public boolean gd_loaded ( )
Is GD Installed?
Returns
boolean
public mixed gd_version ( )
Get GD version
Returns
mixed
public set_error ( string $msg )
Set error message
Parameters
$msg
string
public string display_errors ( string $open = '<p>', mixed $close = '</p>' )
Show error messages
Parameters
$open
string
$close
Returns
string
<table class="summary" id="properties">
<caption>Properties summary</caption>
<tr data-order="image_library" id="$image_library">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$image_library
'gd2'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="library_path" id="$library_path">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$library_path
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="dynamic_output" id="$dynamic_output">
<td class="attributes"><code>
public
boolean
</code></td>
<td class="name">
$dynamic_output
FALSE
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="source_image" id="$source_image">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$source_image
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="new_image" id="$new_image">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$new_image
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="width" id="$width">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$width
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="height" id="$height">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$height
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="quality" id="$quality">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$quality
'90'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="create_thumb" id="$create_thumb">
<td class="attributes"><code>
public
boolean
</code></td>
<td class="name">
$create_thumb
FALSE
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="thumb_marker" id="$thumb_marker">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$thumb_marker
'_thumb'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="maintain_ratio" id="$maintain_ratio">
<td class="attributes"><code>
public
boolean
</code></td>
<td class="name">
$maintain_ratio
TRUE
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="master_dim" id="$master_dim">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$master_dim
'auto'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="rotation_angle" id="$rotation_angle">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$rotation_angle
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="x_axis" id="$x_axis">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$x_axis
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="y_axis" id="$y_axis">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$y_axis
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_text" id="$wm_text">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$wm_text
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_type" id="$wm_type">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$wm_type
'text'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_x_transp" id="$wm_x_transp">
<td class="attributes"><code>
public
integer
</code></td>
<td class="name">
$wm_x_transp
4
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_y_transp" id="$wm_y_transp">
<td class="attributes"><code>
public
integer
</code></td>
<td class="name">
$wm_y_transp
4
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_overlay_path" id="$wm_overlay_path">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$wm_overlay_path
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_font_path" id="$wm_font_path">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$wm_font_path
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_font_size" id="$wm_font_size">
<td class="attributes"><code>
public
integer
</code></td>
<td class="name">
$wm_font_size
17
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_vrt_alignment" id="$wm_vrt_alignment">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$wm_vrt_alignment
'B'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_hor_alignment" id="$wm_hor_alignment">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$wm_hor_alignment
'C'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_padding" id="$wm_padding">
<td class="attributes"><code>
public
integer
</code></td>
<td class="name">
$wm_padding
0
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_hor_offset" id="$wm_hor_offset">
<td class="attributes"><code>
public
integer
</code></td>
<td class="name">
$wm_hor_offset
0
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_vrt_offset" id="$wm_vrt_offset">
<td class="attributes"><code>
public
integer
</code></td>
<td class="name">
$wm_vrt_offset
0
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_font_color" id="$wm_font_color">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$wm_font_color
'#ffffff'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_shadow_color" id="$wm_shadow_color">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$wm_shadow_color
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_shadow_distance" id="$wm_shadow_distance">
<td class="attributes"><code>
public
integer
</code></td>
<td class="name">
$wm_shadow_distance
2
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_opacity" id="$wm_opacity">
<td class="attributes"><code>
public
integer
</code></td>
<td class="name">
$wm_opacity
50
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="source_folder" id="$source_folder">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$source_folder
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="dest_folder" id="$dest_folder">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$dest_folder
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="mime_type" id="$mime_type">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$mime_type
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="orig_width" id="$orig_width">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$orig_width
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="orig_height" id="$orig_height">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$orig_height
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="image_type" id="$image_type">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$image_type
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="size_str" id="$size_str">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$size_str
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="full_src_path" id="$full_src_path">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$full_src_path
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="full_dst_path" id="$full_dst_path">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$full_dst_path
''
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="create_fnc" id="$create_fnc">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$create_fnc
'imagecreatetruecolor'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="copy_fnc" id="$copy_fnc">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$copy_fnc
'imagecopyresampled'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="error_msg" id="$error_msg">
<td class="attributes"><code>
public
array
</code></td>
<td class="name">
$error_msg
array()
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_use_drop_shadow" id="$wm_use_drop_shadow">
<td class="attributes"><code>
public
boolean
</code></td>
<td class="name">
$wm_use_drop_shadow
FALSE
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="wm_use_truetype" id="$wm_use_truetype">
<td class="attributes"><code>
public
boolean
</code></td>
<td class="name">
$wm_use_truetype
FALSE
<div class="description detailed">
</div>
</div></td>
</tr>
</table>