1 | <?php |
||
23 | class ImageThumb |
||
24 | { |
||
25 | /** |
||
26 | * Create image thumbnail object |
||
27 | * |
||
28 | * @param string $filename |
||
29 | * @param array $options |
||
30 | * @param array $plugins |
||
31 | * @return PHPThumb |
||
32 | */ |
||
33 | public function create($filename = null, array $options = [], array $plugins = []) |
||
34 | { |
||
35 | try { |
||
36 | $thumb = new PHPThumb($filename, $options, $plugins); |
||
37 | } catch (\Exception $exc) { |
||
38 | throw new Exception\RuntimeException($exc->getMessage(), $exc->getCode(), $exc); |
||
39 | } |
||
40 | |||
41 | return $thumb; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Create reflection plugin |
||
46 | * |
||
47 | * @param int $percent |
||
48 | * @param int $reflection |
||
49 | * @param int $white |
||
50 | * @param bool $border |
||
51 | * @param string $borderColor hex |
||
52 | * @return Plugins\Reflection |
||
53 | */ |
||
54 | public function createReflection($percent, $reflection, $white, $border, $borderColor) |
||
58 | |||
59 | /** |
||
60 | * Create a plugin to crop the whitespace surrounding an image |
||
61 | * |
||
62 | * @param int $border |
||
63 | * @param int $color |
||
64 | * @return ExtraPlugins\WhitespaceCropper |
||
65 | */ |
||
66 | public function createWhitespaceCropper($border = 0, $color = 0) |
||
70 | |||
71 | /** |
||
72 | * Create a beautifull sharpen image |
||
73 | * |
||
74 | * @param int $offset |
||
75 | * @param array $matrix |
||
76 | * @return ExtraPlugins\Sharpen |
||
77 | */ |
||
78 | public function createSharpen($offset = 0, array $matrix = []) |
||
82 | |||
83 | /** |
||
84 | * Create a watermark on image |
||
85 | * |
||
86 | * @param PHPThumb $watermarkThumb |
||
87 | * @param array $position |
||
88 | * @param float $scale |
||
89 | * @return ExtraPlugins\Watermark |
||
90 | */ |
||
91 | public function createWatermark(PHPThumb $watermarkThumb, array $position = [0, 0], $scale = .5) |
||
95 | } |
||
96 |