Skip to content
This repository was archived by the owner on Mar 5, 2022. It is now read-only.

Latest commit

 

History

History
55 lines (44 loc) · 868 Bytes

Basic-Example.md

File metadata and controls

55 lines (44 loc) · 868 Bytes

Basic Example

Add the behavior to the table:

class SomeTable extends Table {
	public function initialize(array $config) {
		$this->addBehavior('Burzum/Imagine.Imagine');
	}
}

Now you can start manipulating images.

Flip an image vertical and crop it to 100x100px:

$imageOperations = array(
	'flip' => [
		'direction' => 'vertically'
	],
	'crop' => [
		'height' => 100,
		'width' => 100
	],
);

$this->Image->processImage(
	APP . 'files' . DS . 'image.jpg',
	APP . 'files' . DS . 'modifiedImage.jpg',
	[],
	$imageOperations
);

Create a thumbnail with a max height of 600px and a max width of 200px:

$imageOperations = [
	'thumbnail' => [
		'height' => 600,
		'width' => 200
	],
];

$this->Image->processImage(
	APP . 'files' . DS . 'image.jpg',
	APP . 'files' . DS . 'modifiedImage.jpg',
	[],
	$imageOperations
);