CI_Image_lib::rotate()

rotate()

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

The image rotation method requires that the angle of rotation be set via its preference:

$config['rotation_angle'] = '90';

There are 5 rotation options:

  1. 90 - rotates counter-clockwise by 90 degrees.
  2. 180 - rotates counter-clockwise by 180 degrees.
  3. 270 - rotates counter-clockwise by 270 degrees.
  4. hor - flips the image horizontally.
  5. vrt - flips the image vertically.

Here’s an example showing how you might rotate an image:

$config['image_library'] = 'netpbm';
$config['library_path'] = '/usr/bin/';
$config['source_image'] = '/path/to/image/mypic.jpg';
$config['rotation_angle'] = 'hor';

$this->image_lib->initialize($config);

if ( ! $this->image_lib->rotate())
{
        echo $this->image_lib->display_errors();
}
doc_CodeIgniter
2016-10-15 16:31:37
Comments
Leave a Comment

Please login to continue.