-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.php
110 lines (85 loc) · 3 KB
/
test.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
<?php
require_once __DIR__ . '/vendor/autoload.php';
use AJUR\Wrappers\GDWrapper;
use AJUR\Wrappers\GDWrapperInterface;
if (!is_readable(__DIR__ . '/test.jpg')) {
die(PHP_EOL . PHP_EOL . 'Any `test.jpg` is needed for testing' . PHP_EOL . PHP_EOL);
}
GDWrapper::init([
'JPEG_COMPRESSION_QUALITY' => 80,
'WEBP_COMPRESSION_QUALITY' => 100,
'PNG_COMPRESSION_QUALITY' => 0
]);
echo 'Making watermark file' . PHP_EOL;
GDWrapper::resizeImageAspect('test.jpg', 'watermark.png', 100, 100);
$wm = GDWrapper::applyImageFilter('watermark.png', IMG_FILTER_NEGATE);
$wm->store()->destroyImage();
echo "cropImage: " . PHP_EOL;
var_dump(
GDWrapper::cropImage('test.jpg', 'test_crop.jpg', [ 100, 100], [ 900, 900 ], [ 900, 900 ], 70)
);
echo "resizeImageAspect: " . PHP_EOL;
var_dump(
GDWrapper::resizeImageAspect('test.jpg', 'test_RIA.png', 700, 200)
);
echo "resizeImageAspect: " . PHP_EOL;
var_dump(
GDWrapper::resizeImageAspect('test.jpg', 'test_RIA.jpg', 200, 500, 40)
);
echo "resizePictureAspect: " . PHP_EOL;
var_dump(
GDWrapper::resizePictureAspect('test.jpg', 'test_RPA.png', 700, 200)
);
echo "resizePictureAspect: " . PHP_EOL;
var_dump(
GDWrapper::resizePictureAspect('test.jpg', 'test_RPA.jpg', 200, 500, 40)
);
echo "verticalImage: " . PHP_EOL;
var_dump(
GDWrapper::verticalImage('test.jpg', 'test_VI.jpg', 300, 300, 80)
);
echo "getFixedPicture: " . PHP_EOL;
var_dump(
GDWrapper::getFixedPicture('test.jpg', 'test_GFP.jpg', 470, 370, 90)
);
echo "addWaterMark: " . PHP_EOL;
var_dump(
GDWrapper::addWaterMark('test.jpg', ['watermark' => 'watermark.png', 'margin' => 10] , GDWrapperInterface::WM_POSITION_LEFT_TOP, null, 'test-wm-10.jpg')
);
echo "addWaterMark: " . PHP_EOL;
var_dump(
GDWrapper::addWaterMark('test.jpg', ['watermark' => 'watermark.png', 'margin' => 20] , GDWrapperInterface::WM_POSITION_RIGHT_BOTTOM, null, 'test-wm-20.jpg')
);
echo "addWaterMark: " . PHP_EOL;
var_dump(
GDWrapper::addWaterMark('test.jpg', ['watermark' => 'watermark.png', 'margin' => 50] , GDWrapperInterface::WM_POSITION_LEFT_BOTTOM, null, 'test-wm-50.jpg')
);
echo "addWaterMark: " . PHP_EOL;
var_dump(
GDWrapper::addWaterMark('test.jpg', ['watermark' => '_watermark_m.png', 'margin' => 50] , GDWrapperInterface::WM_POSITION_LEFT_BOTTOM, null, 'test-2.jpg')
);
echo "rotate: " . PHP_EOL;
var_dump(
GDWrapper::rotate('test.jpg', 'left', 90, 'test_kid_rotate90.jpg')
);
echo "cropImage: " . PHP_EOL;
var_dump(
GDWrapper::cropImage('test.jpg', 'test_crop.jpg', [ 100, 100 ] , [ 800, 1000 ], [ 1000, 1000 ], 90)
);
echo "resizeImageAspect: " . PHP_EOL;
var_dump(
GDWrapper::resizeImageAspect('test.jpg', 'test_RIA.jpg', 200, 500, 40)
);
echo "imageFillColor: " . PHP_EOL;
var_dump(
GDWrapper::imageFillColor('test_red.png', 500, 500, [ 255 ], 90)
);
echo "imageFillColor: " . PHP_EOL;
var_dump(
GDWrapper::imageFillColor('test_yellow.webp', 500, 500, [ 255, 255 ], 90)
);
/*
$f = new \AJUR\Wrappers\GDImageInfo('test.jpg');
$f->changeExtension('webp');
var_dump($f->filename);
*/