PHP Class CI_Image_lib, TastyIgniter

Author: ExpressionEngine Dev Team
Afficher le fichier Open project: tastyigniter/tastyigniter Class Usage Examples

Méthodes publiques

Свойство Type Description
$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 Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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

Method Details

__construct() public méthode

Initialize Image Library
public __construct ( array $props = [] ) : void
$props array
Résultat void

clear() public méthode

Resets values in case this class is used in a loop
public clear ( ) : void
Résultat void

crop() public méthode

This is a wrapper function that chooses the proper cropping function based on the protocol specified
public crop ( ) : boolean
Résultat boolean

display_errors() public méthode

Show error messages
public display_errors ( $open = '<p>', $close = '</p>' ) : string
Résultat string

explode_name() public méthode

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
Résultat array

gd_loaded() public méthode

Is GD Installed?
public gd_loaded ( ) : boolean
Résultat boolean

gd_version() public méthode

Get GD version
public gd_version ( ) : mixed
Résultat mixed

get_image_properties() public méthode

A helper function that gets info about the file
public get_image_properties ( $path = '', $return = FALSE ) : mixed
Résultat mixed

image_create_gd() public méthode

This simply creates an image resource handle based on the type of image being processed
public image_create_gd ( $path = '', $image_type = '' ) : resource
Résultat resource

image_display_gd() public méthode

Dynamically outputs an image
public image_display_gd ( $resource ) : void
Résultat void

image_mirror_gd() public méthode

This function will flip horizontal or vertical
public image_mirror_gd ( ) : boolean
Résultat boolean

image_process_gd() public méthode

This function will resize or crop
public image_process_gd ( $action = 'resize' ) : boolean
Résultat boolean

image_process_imagemagick() public méthode

This function will resize, crop or rotate
public image_process_imagemagick ( $action = 'resize' ) : boolean
Résultat boolean

image_process_netpbm() public méthode

This function will resize, crop or rotate
public image_process_netpbm ( $action = 'resize' ) : boolean
Résultat boolean

image_reproportion() public méthode

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
Résultat void

image_rotate_gd() public méthode

Image Rotate Using GD
public image_rotate_gd ( ) : boolean
Résultat boolean

image_save_gd() public méthode

Takes an image resource as input and writes the file to the specified destination
public image_save_gd ( $resource ) : boolean
Résultat boolean

initialize() public méthode

initialize image preferences
public initialize ( $props = [] ) : boolean
Résultat boolean

overlay_watermark() public méthode

Watermark - Graphic Version
public overlay_watermark ( ) : boolean
Résultat boolean

resize() public méthode

This is a wrapper function that chooses the proper resize function based on the protocol specified
public resize ( ) : boolean
Résultat boolean

rotate() public méthode

This is a wrapper function that chooses the proper rotation function based on the protocol specified
public rotate ( ) : boolean
Résultat boolean

set_error() public méthode

Set error message
public set_error ( $msg ) : void
Résultat void

size_calculator() public méthode

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
Résultat array

text_watermark() public méthode

Watermark - Text Version
public text_watermark ( ) : boolean
Résultat boolean

watermark() public méthode

This is a wrapper function that chooses the type of watermarking based on the specified preference.
public watermark ( ) : boolean
Résultat boolean

Property Details

$copy_fnc public_oe property

Name of function to copy image
public string $copy_fnc
Résultat string

$create_fnc public_oe property

Name of function to create image
public string $create_fnc
Résultat string

$create_thumb public_oe property

Whether to create a thumbnail
public bool $create_thumb
Résultat boolean

$dest_folder public_oe property

Destination image folder
public string $dest_folder
Résultat string

$dynamic_output public_oe property

Whether to send to browser or write to disk
public bool $dynamic_output
Résultat boolean

$error_msg public_oe property

Error messages
public array $error_msg
Résultat array

$file_permissions public_oe property

File permissions
public int $file_permissions
Résultat integer

$full_dst_path public_oe property

Full path to destination image
public string $full_dst_path
Résultat string

$full_src_path public_oe property

Full path to source image
public string $full_src_path
Résultat string

$height public_oe property

Image height
public int $height
Résultat integer

$image_library public_oe property

PHP extension/library to use for image manipulation Can be: imagemagick, netpbm, gd, gd2
public string $image_library
Résultat string

$image_type public_oe property

Image format
public string $image_type
Résultat string

$library_path public_oe property

Path to the graphic library (if applicable)
public string $library_path
Résultat string

$maintain_ratio public_oe property

Whether to maintain aspect ratio when resizing or use hard values
public bool $maintain_ratio
Résultat boolean

$master_dim public_oe property

auto, height, or width. Determines what to use as the master dimension
public string $master_dim
Résultat string

$mime_type public_oe property

Image mime-type
public string $mime_type
Résultat string

$new_image public_oe property

Path to the modified image
public string $new_image
Résultat string

$orig_height public_oe property

Original image height
public int $orig_height
Résultat integer

$orig_width public_oe property

Original image width
public int $orig_width
Résultat integer

$quality public_oe property

Quality percentage of new image
public int $quality
Résultat integer

$rotation_angle public_oe property

Angle at to rotate image
public string $rotation_angle
Résultat string

$size_str public_oe property

Size of current image
public string $size_str
Résultat string

$source_folder public_oe property

Source image folder
public string $source_folder
Résultat string

$source_image public_oe property

Path to original image
public string $source_image
Résultat string

$thumb_marker public_oe property

String to add to thumbnail version of image
public string $thumb_marker
Résultat string

$width public_oe property

Image width
public int $width
Résultat integer

$wm_font_color protected_oe property

Text color
protected string $wm_font_color
Résultat string

$wm_font_path public_oe property

TT font
public string $wm_font_path
Résultat string

$wm_font_size public_oe property

Font size (different versions of GD will either use points or pixels)
public int $wm_font_size
Résultat integer

$wm_hor_alignment public_oe property

Horizontal alignment: L R C
public string $wm_hor_alignment
Résultat string

$wm_hor_offset public_oe property

Lets you push text to the right
public int $wm_hor_offset
Résultat integer

$wm_opacity public_oe property

Image opacity: 1 - 100 Only works with image
public int $wm_opacity
Résultat integer

$wm_overlay_path public_oe property

Watermark image path
public string $wm_overlay_path
Résultat string

$wm_padding public_oe property

Padding around text
public int $wm_padding
Résultat integer

$wm_shadow_color protected_oe property

Dropshadow color
protected string $wm_shadow_color
Résultat string

$wm_shadow_distance public_oe property

Dropshadow distance
public int $wm_shadow_distance
Résultat integer

$wm_text public_oe property

Watermark text if graphic is not used
public string $wm_text
Résultat string

$wm_type public_oe property

Type of watermarking. Options: text/overlay
public string $wm_type
Résultat string

$wm_use_drop_shadow protected_oe property

Whether to have a drop shadow on watermark
protected bool $wm_use_drop_shadow
Résultat boolean

$wm_use_truetype public_oe property

Whether to use truetype fonts
public bool $wm_use_truetype
Résultat boolean

$wm_vrt_alignment public_oe property

Vertical alignment: T M B
public string $wm_vrt_alignment
Résultat string

$wm_vrt_offset public_oe property

Lets you push text down
public int $wm_vrt_offset
Résultat integer

$wm_x_transp public_oe property

Default transparency for watermark
public int $wm_x_transp
Résultat integer

$wm_y_transp public_oe property

Default transparency for watermark
public int $wm_y_transp
Résultat integer

$x_axis public_oe property

X Coordinate for manipulation of the current image
public int $x_axis
Résultat integer

$y_axis public_oe property

Y Coordinate for manipulation of the current image
public int $y_axis
Résultat integer