-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.php
112 lines (96 loc) · 3.37 KB
/
helpers.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
use AJUR\Wrappers\GDImageInfo;
use AJUR\Wrappers\GDWrapper;
interface GDWrapperHelpers {
function getfixedpicture(string $fn_source, string $fn_target, int $maxwidth, int $maxheight, $image_quality = null):GDImageInfo;
function resizeimageaspect(string $fn_source, string $fn_target, int $maxwidth, int $maxheight, $image_quality = null):GDImageInfo;
function verticalimage(string $fn_source, string $fn_target, int $maxwidth, int $maxheight, $image_quality = null):GDImageInfo;
function resizepictureaspect(string $fn_source, string $fn_target, int $maxwidth, int $maxheight, $image_quality = null):GDImageInfo;
function toRange($value, $min, $max);
}
if (!function_exists('cropimage')) {
/**
* CropImage helper
*
* @param string $fn_source
* @param string $fn_target
* @param array $xy_source
* @param array $wh_dest
* @param array $wh_source
* @param null $quality
* @return GDImageInfo
*/
function cropImage(string $fn_source, string $fn_target, array $xy_source, array $wh_dest, array $wh_source, $quality = null): GDImageInfo
{
return GDWrapper::cropImage($fn_source, $fn_target, $xy_source, $wh_dest, $wh_source, $quality);
}
}
if (!function_exists('getfixedpicture')) {
/**
* @param string $fn_source
* @param string $fn_target
* @param int $maxwidth
* @param int $maxheight
* @param null $image_quality
* @return bool
*/
function getfixedpicture(string $fn_source, string $fn_target, int $maxwidth, int $maxheight, $image_quality = null):GDImageInfo
{
return GDWrapper::getFixedPicture($fn_source, $fn_target, $maxwidth, $maxheight, $image_quality);
}
}
if (!function_exists('resizeimageaspect')) {
/**
* @param string $fn_source
* @param string $fn_target
* @param int $maxwidth
* @param int $maxheight
* @param null $image_quality
* @return bool
*/
function resizeimageaspect(string $fn_source, string $fn_target, int $maxwidth, int $maxheight, $image_quality = null):GDImageInfo
{
return GDWrapper::resizeImageAspect($fn_source, $fn_target, $maxwidth, $maxheight, $image_quality);
}
}
if (!function_exists('verticalimage')) {
/**
* @param string $fn_source
* @param string $fn_target
* @param int $maxwidth
* @param int $maxheight
* @param null $image_quality
* @return bool
*/
function verticalimage(string $fn_source, string $fn_target, int $maxwidth, int $maxheight, $image_quality = null):GDImageInfo
{
return GDWrapper::verticalImage($fn_source, $fn_target, $maxwidth, $maxheight, $image_quality);
}
}
if (!function_exists('resizepictureaspect')) {
/**
* @param string $fn_source
* @param string $fn_target
* @param int $maxwidth
* @param int $maxheight
* @param null $image_quality
* @return bool
*/
function resizepictureaspect(string $fn_source, string $fn_target, int $maxwidth, int $maxheight, $image_quality = null):GDImageInfo
{
return GDWrapper::resizePictureAspect($fn_source, $fn_target, $maxwidth, $maxheight, $image_quality);
}
}
if (!function_exists('toRange')) {
/**
*
* @param $value
* @param $min
* @param $max
* @return mixed
*/
function toRange($value, $min, $max)
{
return max($min, min($value, $max));
}
}