Skip to content

Commit e5a3b12

Browse files
committed
PSR-2
1 parent 5a15f40 commit e5a3b12

16 files changed

+1712
-1566
lines changed

.editorconfig

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
root = true
2+
[*]
3+
end_of_line = lf
4+
insert_final_newline = true
5+
indent_style = space
6+
indent_size = 4
7+
trim_trailing_whitespace = true

.travis.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ sudo: false
33
language: php
44

55
php:
6-
- 5.5
7-
- 5.6
8-
- 7.0
9-
- 7.1
10-
- hhvm
6+
- 5.5
7+
- 5.6
8+
- 7.0
9+
- 7.1
10+
- hhvm
1111

1212
matrix:
13-
allow_failures:
14-
- php: hhvm
13+
allow_failures:
14+
- php: hhvm
1515

16-
fast_finish: true
16+
fast_finish: true
1717

1818
install: travis_retry composer install --no-interaction --prefer-source
1919

2020
script: make test
2121

2222
notifications:
23-
email: false
23+
email: false
2424

2525
git:
26-
depth: 1
26+
depth: 1

composer.json

+42-42
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
{
2-
"name": "joseluisq/gimage",
3-
"description": "A simple PHP library for easy image handling.",
4-
"type": "library",
5-
"license": "MIT",
6-
"keywords": [
7-
"image",
8-
"gd",
9-
"png",
10-
"jpg",
11-
"jpeg",
12-
"resize",
13-
"crop",
14-
"file",
15-
"save",
16-
"handler"
17-
],
18-
"authors": [{
19-
"name": "José Luis Quintana",
20-
"homepage": "https://git.io/joseluisq",
21-
"role": "Owner"
2+
"name": "joseluisq/gimage",
3+
"description": "A simple PHP library for easy image handling.",
4+
"type": "library",
5+
"license": "MIT",
6+
"keywords": [
7+
"image",
8+
"gd",
9+
"png",
10+
"jpg",
11+
"jpeg",
12+
"resize",
13+
"crop",
14+
"file",
15+
"save",
16+
"handler"
17+
],
18+
"authors": [{
19+
"name": "José Luis Quintana",
20+
"homepage": "https://git.io/joseluisq",
21+
"role": "Owner"
2222
}],
23-
"support": {
24-
"issues": "https://github.com/joseluisq/gimage/issues"
25-
},
26-
"require": {
27-
"php": ">=5.5",
28-
"guzzlehttp/psr7": "^1.3.1"
29-
},
30-
"require-dev": {
31-
"phpunit/phpunit": "^4.0"
32-
},
33-
"autoload": {
34-
"psr-4": {
35-
"GImage\\": "src/"
23+
"support": {
24+
"issues": "https://github.com/joseluisq/gimage/issues"
25+
},
26+
"require": {
27+
"php": ">=5.5",
28+
"guzzlehttp/psr7": "^1.3.1"
29+
},
30+
"require-dev": {
31+
"phpunit/phpunit": "^4.0"
32+
},
33+
"autoload": {
34+
"psr-4": {
35+
"GImage\\": "src/"
36+
}
37+
},
38+
"autoload-dev": {
39+
"psr-4": {
40+
"GImage\\Tests\\": "tests/"
41+
}
42+
},
43+
"suggest": {
44+
"ext-gd": "To use GD library based on image processing."
3645
}
37-
},
38-
"autoload-dev": {
39-
"psr-4": {
40-
"GImage\\Tests\\": "tests/"
41-
}
42-
},
43-
"suggest": {
44-
"ext-gd": "To use GD library based on image processing."
45-
}
4646
}

examples/card.php

+56-48
Original file line numberDiff line numberDiff line change
@@ -17,70 +17,78 @@
1717
// Creating an avatar image
1818
$avatar_image = new Image();
1919
$avatar_image
20-
->load('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')
21-
->centerCrop(100, 100)
22-
->setTop(60)
23-
->setLeft(70);
20+
->load('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')
21+
->centerCrop(100, 100)
22+
->setTop(60)
23+
->setLeft(70);
2424

2525
$about_text = new Text("MY AWESOME PRESENTATION CARD\n~ BY GIMAGE ~");
2626
$about_text->setSize(16)
27-
->setWidth(300)
28-
->setLeft(210)
29-
->setLineHeight(1.5)
30-
->setTop(75)
31-
->setColor(204, 164, 116)
32-
->setFontface(BASE_PATH . '/fonts/Lato-Lig.ttf');
27+
->setWidth(300)
28+
->setLeft(210)
29+
->setLineHeight(1.5)
30+
->setTop(75)
31+
->setColor(204, 164, 116)
32+
->setFontface(BASE_PATH . '/fonts/Lato-Lig.ttf');
3333

3434
$twitter_text = new Text('@joseluisq/gimage');
35-
$twitter_text->setSize(11);
36-
$twitter_text->setWidth(70);
37-
$twitter_text->setLeft(410);
38-
$twitter_text->setTop(210);
39-
$twitter_text->setColor(130, 127, 125);
40-
$twitter_text->setFontface(BASE_PATH . '/fonts/Lato-Reg.ttf');
35+
$twitter_text
36+
->setSize(11)
37+
->setWidth(70)
38+
->setLeft(410)
39+
->setTop(210)
40+
->setColor(130, 127, 125)
41+
->setFontface(BASE_PATH . '/fonts/Lato-Reg.ttf');
4142

4243
$canvas_figure = new Figure(550, 250);
43-
$canvas_figure->setBackgroundColor(47, 42, 39);
44-
$canvas_figure->create();
44+
$canvas_figure
45+
->setBackgroundColor(47, 42, 39)
46+
->create();
4547

4648
$avatar_box = new Figure($avatar_image->getWidth() + 16, $avatar_image->getHeight() + 17);
47-
$avatar_box->setBackgroundColor(63, 56, 52);
48-
$avatar_box->setLeft($avatar_image->getLeft() - 7);
49-
$avatar_box->setTop($avatar_image->getTop() - 8);
50-
$avatar_box->create();
49+
$avatar_box
50+
->setBackgroundColor(63, 56, 52)
51+
->setLeft($avatar_image->getLeft() - 7)
52+
->setTop($avatar_image->getTop() - 8)
53+
->create();
5154

5255
$avatar_box2 = new Figure($avatar_image->getWidth() + 3, $avatar_image->getHeight() + 19);
53-
$avatar_box2->setBackgroundColor(79, 72, 67);
54-
$avatar_box2->setLeft($avatar_image->getLeft() + 7);
55-
$avatar_box2->setTop($avatar_image->getTop() - 9);
56-
$avatar_box2->create();
56+
$avatar_box2
57+
->setBackgroundColor(79, 72, 67)
58+
->setLeft($avatar_image->getLeft() + 7)
59+
->setTop($avatar_image->getTop() - 9)
60+
->create();
5761

5862
$avatar_box3 = new Figure(120, 240);
59-
$avatar_box3->setBackgroundColor(63, 56, 52);
60-
$avatar_box3->create();
63+
$avatar_box3
64+
->setBackgroundColor(63, 56, 52)
65+
->create();
6166

6267
$line_vertical = new Figure(600, 10);
63-
$line_vertical->setBackgroundColor(119, 99, 77);
64-
$line_vertical->setTop(240);
65-
$line_vertical->create();
68+
$line_vertical
69+
->setBackgroundColor(119, 99, 77)
70+
->setTop(240)
71+
->create();
6672

6773
$line_horizontal = new Figure(1, 240);
68-
$line_horizontal->setBackgroundColor(79, 72, 67);
69-
$line_horizontal->setLeft(120);
70-
$line_horizontal->create();
74+
$line_horizontal
75+
->setBackgroundColor(79, 72, 67)
76+
->setLeft(120)
77+
->create();
7178

7279
$canvas = new Canvas();
73-
$canvas->from($canvas_figure);
74-
$canvas->append(array(
75-
$line_horizontal,
76-
$avatar_box2,
77-
$avatar_box3,
78-
$avatar_box,
79-
$avatar_image,
80-
$about_text,
81-
$twitter_text,
82-
$line_vertical
83-
));
84-
$canvas->toPNG();
85-
$canvas->draw();
86-
$canvas->save(__DIR__ . '/card.png');
80+
$canvas
81+
->from($canvas_figure)
82+
->append([
83+
$line_horizontal,
84+
$avatar_box2,
85+
$avatar_box3,
86+
$avatar_box,
87+
$avatar_image,
88+
$about_text,
89+
$twitter_text,
90+
$line_vertical
91+
])
92+
->toPNG()
93+
->draw()
94+
->save(__DIR__ . '/card.png');

examples/crop.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
require __DIR__ . '/../tests/bootstrap.php';
1313

1414
$image = new Image();
15-
// Load an image (300px x 300px)
1615
$image
17-
->load('http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=300.jpg')
18-
// Resize and crop in the middle (100px x 60px)
19-
->centerCrop(100, 60)
20-
->save(__DIR__ . '/crop.jpg');
16+
// Load an image (300px x 300px)
17+
->load('http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=300.jpg')
18+
// Resize and crop in the middle (100px x 60px)
19+
->centerCrop(100, 60)
20+
->save(__DIR__ . '/crop.jpg');

examples/rotate.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
// Rotate an image to 90º
1515
$image = new Image();
1616
$image
17-
->load('http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=100.jpg')
18-
->rotate(90)
19-
->save(__DIR__ . '/rotate.jpg');
17+
->load('http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=100.jpg')
18+
->rotate(90)
19+
->save(__DIR__ . '/rotate.jpg');

examples/text.php

+15-14
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,23 @@
1515

1616
$figure = new Figure(400, 250);
1717
$figure
18-
->setBackgroundColor(47, 42, 39)
19-
->create();
18+
->setBackgroundColor(47, 42, 39)
19+
->create();
2020

2121
$text = new Text('Output PNG .');
22-
$text->setWidth(400)
23-
->setHeight(250)
24-
->setLineHeight(1.2)
25-
->setAlign('center')
26-
->setValign('center')
27-
->setSize(22)
28-
->setColor(255, 255, 255)
29-
->setFontface(BASE_PATH . '/fonts/Lato-Bol.ttf');
22+
$text
23+
->setWidth(400)
24+
->setHeight(250)
25+
->setLineHeight(1.2)
26+
->setAlign('center')
27+
->setValign('center')
28+
->setSize(22)
29+
->setColor(255, 255, 255)
30+
->setFontface(BASE_PATH . '/fonts/Lato-Bol.ttf');
3031

3132
$canvas = new Canvas($figure);
3233
$canvas
33-
->append($text)
34-
->toPNG()
35-
->draw()
36-
->save(__DIR__ . '/text.png');
34+
->append($text)
35+
->toPNG()
36+
->draw()
37+
->save(__DIR__ . '/text.png');

phpunit.xml

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit bootstrap="./tests/bootstrap.php" colors="true">
4-
<testsuites>
5-
<testsuite name="GImage Test">
6-
<directory>tests</directory>
7-
</testsuite>
8-
</testsuites>
9-
<filter>
10-
<whitelist>
11-
<directory suffix=".php">src</directory>
12-
</whitelist>
13-
</filter>
4+
<testsuites>
5+
<testsuite name="GImage Test">
6+
<directory>tests</directory>
7+
</testsuite>
8+
</testsuites>
9+
<filter>
10+
<whitelist>
11+
<directory suffix=".php">src</directory>
12+
</whitelist>
13+
</filter>
1414
</phpunit>

0 commit comments

Comments
 (0)