circle()¶| Returns: | TRUE on success, FALSE on failure |
|---|---|
| Return type: | bool |
To crop a circle from the original image, the x radius must be set. The following example will crop a circle 180px wide from the original image:
$config['cx_radius'] = 90;
The circle method will also crop an ellipse. For that, the y radius also needs to be provided. The following example will create an ellipse 180px wide and 240px high:
$config['cx_radius'] = 90;
$config['cy_radius'] = 120;
The center of the circle needs to be provided. The x_axis and y_axis configuration elements are used for this. The following configuration will crop a circle with a diameter of 180px from 100,60 from the original image :
$config['x_axis'] = 100;
$config['y_axis'] = 60;
$config['cx_radius'] = 90;
Here’s an example showing how you might crop a circle :
$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();
}