PHP Класс CI_Image_lib, TastyIgniter

Автор: ExpressionEngine Dev Team
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$copy_fnc string Name of function to copy image
$create_fnc string Name of function to create image
$create_thumb boolean Whether to create a thumbnail
$dest_folder string Destination image folder
$dynamic_output boolean Whether to send to browser or write to disk
$error_msg array Error messages
$file_permissions integer File permissions
$full_dst_path string Full path to destination image
$full_src_path string Full path to source image
$height integer Image height
$image_library string PHP extension/library to use for image manipulation Can be: imagemagick, netpbm, gd, gd2
$image_type string Image format
$library_path string Path to the graphic library (if applicable)
$maintain_ratio boolean Whether to maintain aspect ratio when resizing or use hard values
$master_dim string auto, height, or width. Determines what to use as the master dimension
$mime_type string Image mime-type
$new_image string Path to the modified image
$orig_height integer Original image height
$orig_width integer Original image width
$quality integer Quality percentage of new image
$rotation_angle string Angle at to rotate image
$size_str string Size of current image
$source_folder string Source image folder
$source_image string Path to original image
$thumb_marker string String to add to thumbnail version of image
$width integer Image width
$wm_font_path string TT font
$wm_font_size integer Font size (different versions of GD will either use points or pixels)
$wm_hor_alignment string Horizontal alignment: L R C
$wm_hor_offset integer Lets you push text to the right
$wm_opacity integer Image opacity: 1 - 100 Only works with image
$wm_overlay_path string Watermark image path
$wm_padding integer Padding around text
$wm_shadow_distance integer Dropshadow distance
$wm_text string Watermark text if graphic is not used
$wm_type string Type of watermarking. Options: text/overlay
$wm_use_truetype boolean Whether to use truetype fonts
$wm_vrt_alignment string Vertical alignment: T M B
$wm_vrt_offset integer Lets you push text down
$wm_x_transp integer Default transparency for watermark
$wm_y_transp integer Default transparency for watermark
$x_axis integer X Coordinate for manipulation of the current image
$y_axis integer Y Coordinate for manipulation of the current image

Защищенные свойства (Protected)

Свойство Тип Описание
$wm_font_color string Text color
$wm_shadow_color string Dropshadow color
$wm_use_drop_shadow boolean Whether to have a drop shadow on watermark

Открытые методы

Метод Описание
__construct ( array $props = [] ) : void Initialize Image Library
clear ( ) : void Initialize image properties
crop ( ) : boolean Image Crop
display_errors ( $open = '<p>', $close = '</p>' ) : string Show error messages
explode_name ( $source_image ) : array Explode source_image
gd_loaded ( ) : boolean Is GD Installed?
gd_version ( ) : mixed Get GD version
get_image_properties ( $path = '', $return = FALSE ) : mixed Get image properties
image_create_gd ( $path = '', $image_type = '' ) : resource Create Image - GD
image_display_gd ( $resource ) : void Dynamically outputs an image
image_mirror_gd ( ) : boolean Create Mirror Image using GD
image_process_gd ( $action = 'resize' ) : boolean Image Process Using GD/GD2
image_process_imagemagick ( $action = 'resize' ) : boolean Image Process Using ImageMagick
image_process_netpbm ( $action = 'resize' ) : boolean Image Process Using NetPBM
image_reproportion ( ) : void Re-proportion Image Width/Height
image_rotate_gd ( ) : boolean Image Rotate Using GD
image_save_gd ( $resource ) : boolean Write image file to disk - GD
initialize ( $props = [] ) : boolean initialize image preferences
overlay_watermark ( ) : boolean Watermark - Graphic Version
resize ( ) : boolean Image Resize
rotate ( ) : boolean Image Rotate
set_error ( $msg ) : void Set error message
size_calculator ( $vals ) : array Size calculator
text_watermark ( ) : boolean Watermark - Text Version
watermark ( ) : boolean Image Watermark

Описание методов

__construct() публичный Метод

Initialize Image Library
public __construct ( array $props = [] ) : void
$props array
Результат void

clear() публичный Метод

Resets values in case this class is used in a loop
public clear ( ) : void
Результат void

crop() публичный Метод

This is a wrapper function that chooses the proper cropping function based on the protocol specified
public crop ( ) : boolean
Результат boolean

display_errors() публичный Метод

Show error messages
public display_errors ( $open = '<p>', $close = '</p>' ) : string
Результат string

explode_name() публичный Метод

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';
public explode_name ( $source_image ) : array
Результат array

gd_loaded() публичный Метод

Is GD Installed?
public gd_loaded ( ) : boolean
Результат boolean

gd_version() публичный Метод

Get GD version
public gd_version ( ) : mixed
Результат mixed

get_image_properties() публичный Метод

A helper function that gets info about the file
public get_image_properties ( $path = '', $return = FALSE ) : mixed
Результат mixed

image_create_gd() публичный Метод

This simply creates an image resource handle based on the type of image being processed
public image_create_gd ( $path = '', $image_type = '' ) : resource
Результат resource

image_display_gd() публичный Метод

Dynamically outputs an image
public image_display_gd ( $resource ) : void
Результат void

image_mirror_gd() публичный Метод

This function will flip horizontal or vertical
public image_mirror_gd ( ) : boolean
Результат boolean

image_process_gd() публичный Метод

This function will resize or crop
public image_process_gd ( $action = 'resize' ) : boolean
Результат boolean

image_process_imagemagick() публичный Метод

This function will resize, crop or rotate
public image_process_imagemagick ( $action = 'resize' ) : boolean
Результат boolean

image_process_netpbm() публичный Метод

This function will resize, crop or rotate
public image_process_netpbm ( $action = 'resize' ) : boolean
Результат boolean

image_reproportion() публичный Метод

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 image_reproportion ( ) : void
Результат void

image_rotate_gd() публичный Метод

Image Rotate Using GD
public image_rotate_gd ( ) : boolean
Результат boolean

image_save_gd() публичный Метод

Takes an image resource as input and writes the file to the specified destination
public image_save_gd ( $resource ) : boolean
Результат boolean

initialize() публичный Метод

initialize image preferences
public initialize ( $props = [] ) : boolean
Результат boolean

overlay_watermark() публичный Метод

Watermark - Graphic Version
public overlay_watermark ( ) : boolean
Результат boolean

resize() публичный Метод

This is a wrapper function that chooses the proper resize function based on the protocol specified
public resize ( ) : boolean
Результат boolean

rotate() публичный Метод

This is a wrapper function that chooses the proper rotation function based on the protocol specified
public rotate ( ) : boolean
Результат boolean

set_error() публичный Метод

Set error message
public set_error ( $msg ) : void
Результат void

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' => '' );
public size_calculator ( $vals ) : array
Результат array

text_watermark() публичный Метод

Watermark - Text Version
public text_watermark ( ) : boolean
Результат boolean

watermark() публичный Метод

This is a wrapper function that chooses the type of watermarking based on the specified preference.
public watermark ( ) : boolean
Результат boolean

Описание свойств

$copy_fnc публичное свойство

Name of function to copy image
public string $copy_fnc
Результат string

$create_fnc публичное свойство

Name of function to create image
public string $create_fnc
Результат string

$create_thumb публичное свойство

Whether to create a thumbnail
public bool $create_thumb
Результат boolean

$dest_folder публичное свойство

Destination image folder
public string $dest_folder
Результат string

$dynamic_output публичное свойство

Whether to send to browser or write to disk
public bool $dynamic_output
Результат boolean

$error_msg публичное свойство

Error messages
public array $error_msg
Результат array

$file_permissions публичное свойство

File permissions
public int $file_permissions
Результат integer

$full_dst_path публичное свойство

Full path to destination image
public string $full_dst_path
Результат string

$full_src_path публичное свойство

Full path to source image
public string $full_src_path
Результат string

$height публичное свойство

Image height
public int $height
Результат integer

$image_library публичное свойство

PHP extension/library to use for image manipulation Can be: imagemagick, netpbm, gd, gd2
public string $image_library
Результат string

$image_type публичное свойство

Image format
public string $image_type
Результат string

$library_path публичное свойство

Path to the graphic library (if applicable)
public string $library_path
Результат string

$maintain_ratio публичное свойство

Whether to maintain aspect ratio when resizing or use hard values
public bool $maintain_ratio
Результат boolean

$master_dim публичное свойство

auto, height, or width. Determines what to use as the master dimension
public string $master_dim
Результат string

$mime_type публичное свойство

Image mime-type
public string $mime_type
Результат string

$new_image публичное свойство

Path to the modified image
public string $new_image
Результат string

$orig_height публичное свойство

Original image height
public int $orig_height
Результат integer

$orig_width публичное свойство

Original image width
public int $orig_width
Результат integer

$quality публичное свойство

Quality percentage of new image
public int $quality
Результат integer

$rotation_angle публичное свойство

Angle at to rotate image
public string $rotation_angle
Результат string

$size_str публичное свойство

Size of current image
public string $size_str
Результат string

$source_folder публичное свойство

Source image folder
public string $source_folder
Результат string

$source_image публичное свойство

Path to original image
public string $source_image
Результат string

$thumb_marker публичное свойство

String to add to thumbnail version of image
public string $thumb_marker
Результат string

$width публичное свойство

Image width
public int $width
Результат integer

$wm_font_color защищенное свойство

Text color
protected string $wm_font_color
Результат string

$wm_font_path публичное свойство

TT font
public string $wm_font_path
Результат string

$wm_font_size публичное свойство

Font size (different versions of GD will either use points or pixels)
public int $wm_font_size
Результат integer

$wm_hor_alignment публичное свойство

Horizontal alignment: L R C
public string $wm_hor_alignment
Результат string

$wm_hor_offset публичное свойство

Lets you push text to the right
public int $wm_hor_offset
Результат integer

$wm_opacity публичное свойство

Image opacity: 1 - 100 Only works with image
public int $wm_opacity
Результат integer

$wm_overlay_path публичное свойство

Watermark image path
public string $wm_overlay_path
Результат string

$wm_padding публичное свойство

Padding around text
public int $wm_padding
Результат integer

$wm_shadow_color защищенное свойство

Dropshadow color
protected string $wm_shadow_color
Результат string

$wm_shadow_distance публичное свойство

Dropshadow distance
public int $wm_shadow_distance
Результат integer

$wm_text публичное свойство

Watermark text if graphic is not used
public string $wm_text
Результат string

$wm_type публичное свойство

Type of watermarking. Options: text/overlay
public string $wm_type
Результат string

$wm_use_drop_shadow защищенное свойство

Whether to have a drop shadow on watermark
protected bool $wm_use_drop_shadow
Результат boolean

$wm_use_truetype публичное свойство

Whether to use truetype fonts
public bool $wm_use_truetype
Результат boolean

$wm_vrt_alignment публичное свойство

Vertical alignment: T M B
public string $wm_vrt_alignment
Результат string

$wm_vrt_offset публичное свойство

Lets you push text down
public int $wm_vrt_offset
Результат integer

$wm_x_transp публичное свойство

Default transparency for watermark
public int $wm_x_transp
Результат integer

$wm_y_transp публичное свойство

Default transparency for watermark
public int $wm_y_transp
Результат integer

$x_axis публичное свойство

X Coordinate for manipulation of the current image
public int $x_axis
Результат integer

$y_axis публичное свойство

Y Coordinate for manipulation of the current image
public int $y_axis
Результат integer