CI_Image_lib::resize()

resize()

Returns: TRUE on success, FALSE on failure
Return type: bool

The image resizing method lets you resize the original image, create a copy (with or without resizing), or create a thumbnail image.

For practical purposes there is no difference between creating a copy and creating a thumbnail except a thumb will have the thumbnail marker as part of the name (i.e. mypic_thumb.jpg).

All preferences listed in the Preferences table are available for this method except these three: rotation_angle, x_axis and y_axis.

Creating a Thumbnail

The resizing method will create a thumbnail file (and preserve the original) if you set this preference to TRUE:

$config['create_thumb'] = TRUE;

This single preference determines whether a thumbnail is created or not.

Creating a Copy

The resizing method will create a copy of the image file (and preserve the original) if you set a path and/or a new filename using this preference:

$config['new_image'] = '/path/to/new_image.jpg';

Notes regarding this preference:

  • If only the new image name is specified it will be placed in the same folder as the original
  • If only the path is specified, the new image will be placed in the destination with the same name as the original.
  • If both the path and image name are specified it will placed in its own destination and given the new name.

Resizing the Original Image

If neither of the two preferences listed above (create_thumb, and new_image) are used, the resizing method will instead target the original image for processing.

doc_CodeIgniter
2016-10-15 16:31:37
Comments
Leave a Comment

Please login to continue.