-
Notifications
You must be signed in to change notification settings - Fork 0
CI_Image_lib
Image Manipulation class
- Class name: CI_Image_lib
- Namespace:
public string $image_library = 'gd2'
PHP extension/library to use for image manipulation Can be: imagemagick, netpbm, gd, gd2
- Visibility: public
public string $library_path = ''
Path to the graphic library (if applicable)
- Visibility: public
public boolean $dynamic_output = FALSE
Whether to send to browser or write to disk
- Visibility: public
public string $source_image = ''
Path to original image
- Visibility: public
public string $new_image = ''
Path to the modified image
- Visibility: public
public integer $width = ''
Image width
- Visibility: public
public integer $height = ''
Image height
- Visibility: public
public integer $quality = 90
Quality percentage of new image
- Visibility: public
public boolean $create_thumb = FALSE
Whether to create a thumbnail
- Visibility: public
public string $thumb_marker = '_thumb'
String to add to thumbnail version of image
- Visibility: public
public boolean $maintain_ratio = TRUE
Whether to maintain aspect ratio when resizing or use hard values
- Visibility: public
public string $master_dim = 'auto'
auto, height, or width. Determines what to use as the master dimension
- Visibility: public
public string $rotation_angle = ''
Angle at to rotate image
- Visibility: public
public integer $x_axis = ''
X Coordinate for manipulation of the current image
- Visibility: public
public integer $y_axis = ''
Y Coordinate for manipulation of the current image
- Visibility: public
public string $wm_text = ''
Watermark text if graphic is not used
- Visibility: public
public string $wm_type = 'text'
Type of watermarking. Options: text/overlay
- Visibility: public
public integer $wm_x_transp = 4
Default transparency for watermark
- Visibility: public
public integer $wm_y_transp = 4
Default transparency for watermark
- Visibility: public
public string $wm_overlay_path = ''
Watermark image path
- Visibility: public
public string $wm_font_path = ''
TT font
- Visibility: public
public integer $wm_font_size = 17
Font size (different versions of GD will either use points or pixels)
- Visibility: public
public string $wm_vrt_alignment = 'B'
Vertical alignment: T M B
- Visibility: public
public string $wm_hor_alignment = 'C'
Horizontal alignment: L R C
- Visibility: public
public integer $wm_padding
Padding around text
- Visibility: public
public integer $wm_hor_offset
Lets you push text to the right
- Visibility: public
public integer $wm_vrt_offset
Lets you push text down
- Visibility: public
protected string $wm_font_color = '#ffffff'
Text color
- Visibility: protected
protected string $wm_shadow_color = ''
Dropshadow color
- Visibility: protected
public integer $wm_shadow_distance = 2
Dropshadow distance
- Visibility: public
public integer $wm_opacity = 50
Image opacity: 1 - 100 Only works with image
- Visibility: public
public string $source_folder = ''
Source image folder
- Visibility: public
public string $dest_folder = ''
Destination image folder
- Visibility: public
public string $mime_type = ''
Image mime-type
- Visibility: public
public integer $orig_width = ''
Original image width
- Visibility: public
public integer $orig_height = ''
Original image height
- Visibility: public
public string $image_type = ''
Image format
- Visibility: public
public string $size_str = ''
Size of current image
- Visibility: public
public string $full_src_path = ''
Full path to source image
- Visibility: public
public string $full_dst_path = ''
Full path to destination image
- Visibility: public
public integer $file_permissions = 420
File permissions
- Visibility: public
public string $create_fnc = 'imagecreatetruecolor'
Name of function to create image
- Visibility: public
public string $copy_fnc = 'imagecopyresampled'
Name of function to copy image
- Visibility: public
public array $error_msg = array()
Error messages
- Visibility: public
protected boolean $wm_use_drop_shadow = FALSE
Whether to have a drop shadow on watermark
- Visibility: protected
public boolean $wm_use_truetype = FALSE
Whether to use truetype fonts
- Visibility: public
void CI_Image_lib::__construct(array $props)
Initialize Image Library
- Visibility: public
- $props array
void CI_Image_lib::clear()
Initialize image properties
Resets values in case this class is used in a loop
- Visibility: public
boolean CI_Image_lib::initialize($props)
initialize image preferences
- Visibility: public
- $props mixed
boolean CI_Image_lib::resize()
Image Resize
This is a wrapper function that chooses the proper resize function based on the protocol specified
- Visibility: public
boolean CI_Image_lib::crop()
Image Crop
This is a wrapper function that chooses the proper cropping function based on the protocol specified
- Visibility: public
boolean CI_Image_lib::rotate()
Image Rotate
This is a wrapper function that chooses the proper rotation function based on the protocol specified
- Visibility: public
boolean CI_Image_lib::image_process_gd($action)
Image Process Using GD/GD2
This function will resize or crop
- Visibility: public
- $action mixed
boolean CI_Image_lib::image_process_imagemagick($action)
Image Process Using ImageMagick
This function will resize, crop or rotate
- Visibility: public
- $action mixed
boolean CI_Image_lib::image_process_netpbm($action)
Image Process Using NetPBM
This function will resize, crop or rotate
- Visibility: public
- $action mixed
boolean CI_Image_lib::image_rotate_gd()
Image Rotate Using GD
- Visibility: public
boolean CI_Image_lib::image_mirror_gd()
Create Mirror Image using GD
This function will flip horizontal or vertical
- Visibility: public
boolean CI_Image_lib::watermark()
Image Watermark
This is a wrapper function that chooses the type of watermarking based on the specified preference.
- Visibility: public
boolean CI_Image_lib::overlay_watermark()
Watermark - Graphic Version
- Visibility: public
boolean CI_Image_lib::text_watermark()
Watermark - Text Version
- Visibility: public
resource CI_Image_lib::image_create_gd($path, $image_type)
Create Image - GD
This simply creates an image resource handle based on the type of image being processed
- Visibility: public
- $path mixed
- $image_type mixed
boolean CI_Image_lib::image_save_gd($resource)
Write image file to disk - GD
Takes an image resource as input and writes the file to the specified destination
- Visibility: public
- $resource mixed
void CI_Image_lib::image_display_gd($resource)
Dynamically outputs an image
- Visibility: public
- $resource mixed
void CI_Image_lib::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.
- Visibility: public
mixed CI_Image_lib::get_image_properties($path, $return)
Get image properties
A helper function that gets info about the file
- Visibility: public
- $path mixed
- $return mixed
array CI_Image_lib::size_calculator($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' => '' );
- Visibility: public
- $vals mixed
array CI_Image_lib::explode_name($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';
- Visibility: public
- $source_image mixed
boolean CI_Image_lib::gd_loaded()
Is GD Installed?
- Visibility: public
mixed CI_Image_lib::gd_version()
Get GD version
- Visibility: public
void CI_Image_lib::set_error($msg)
Set error message
- Visibility: public
- $msg mixed
string CI_Image_lib::display_errors($open, $close)
Show error messages
- Visibility: public
- $open mixed
- $close mixed