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