-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCImageComponent.php
executable file
·44 lines (37 loc) · 1000 Bytes
/
CImageComponent.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* Description of CImageComponent
*
* @author Administrator
*/
class CImageComponent extends CApplicationComponent
{
/**
* Drivers available:
* GD - The default driver, requires GD2 version >= 2.0.34 (Debian / Ubuntu users note: Some functions, eg. sharpen may not be available)
* ImageMagick - Windows users must specify a path to the binary. Unix versions will attempt to auto-locate.
* @var string
*/
public $driver = 'GD';
/**
* ImageMagick driver params
* @var array
*/
public $params = array();
public function init()
{
parent::init();
if ($this->driver != 'GD' && $this->driver != 'ImageMagick') {
throw new CException('driver must be GD or ImageMagick');
}
}
public function load($image)
{
$config = array(
'driver' => $this->driver,
'params' => $this->params,
);
return new Image($image, $config);
}
}
?>