Skip to content

Commit b717797

Browse files
committed
Php 5.6 travis
1 parent 48ea0e7 commit b717797

File tree

2 files changed

+33
-36
lines changed

2 files changed

+33
-36
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
language: php
22

33
php:
4+
- 5.6
45
- 7.0
5-
6-
matrix:
7-
allow_failures:
8-
- php: 7.0
6+
- 7.1
97

108
before_script:
119
- mkdir -p build/logs

README.md

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,92 +18,92 @@ It's framework agnostic, which is different from basically everything else I do,
1818

1919
## Installation
2020
You just require using composer and you're good to go!
21-
```bash
21+
````bash
2222
composer require lasserafn/php-initial-avatar-generator
23-
```
23+
````
2424
Rad, *and long*, package name.. huh? Sorry. I'm not very good with names.
2525

2626
## Usage
2727
As with installation, usage is quite simple. Generating a image is done by running:
28-
```php
28+
````php
2929
$avatar = new LasseRafn\InitialAvatarGenerator\InitialAvatar();
3030

3131
$image = $avatar->name('Lasse Rafn')->generate();
32-
```
32+
````
3333

3434
Thats it! The method will return a instance of [Image from Intervention](https://github.com/Intervention/image) so you can stream, download or even encode the image:
35-
```php
35+
````php
3636
return $image->stream('png', 100);
37-
```
37+
````
3838
You can also just pass along the initials, and it will use those. Should you just include a first name, it will use the first two letters of it.
3939

4040
## Supported methods and parameters
4141
Of cause, passing a name is not the only thing this sweet thing does!
4242

4343
### Name (initials) - default: JD
44-
```php
44+
````php
4545
$image = $avatar->name('Albert Magnum')->generate();
46-
```
46+
````
4747

4848
### Size - default: 48
49-
```php
49+
````php
5050
// will be 96x96 pixels.
5151
$image = $avatar->size(96)->generate();
52-
```
52+
````
5353

5454
### Background color - default: #000
55-
```php
55+
````php
5656
// will be red
5757
$image = $avatar->background('#ff0000')->generate();
58-
```
58+
````
5959

6060
### Font color - default: #fff
61-
```php
61+
````php
6262
// will be red
6363
$image = $avatar->color('#ff0000')->generate();
64-
```
64+
````
6565

6666
### Font file - default: /fonts/OpenSans-Regular.ttf
6767
Two fonts are included:
6868
* /fonts/OpenSans-Regular.ttf
6969
* /fonts/OpenSans-Semibold.ttf
7070

71-
The method automatically appends __DIR__ to it, so the font will be: `__DIR__ . '/fonts/OpenSans-Regular.ttf'`
71+
The method automatically appends __DIR__ to it, so the font will be: ````__DIR__ . '/fonts/OpenSans-Regular.ttf'````
7272

73-
```php
73+
````php
7474
// will be Semibold
7575
$image = $avatar->font('/fonts/OpenSans-Semibold.ttf')->generate();
76-
```
76+
````
7777

7878
### Cache - default: 0 = no cache
7979
Will use **intervention/imagecache** to cache the result.
80-
```php
80+
````php
8181
$image = $avatar->cache()->generate(); // 60 minutes
82-
```
82+
````
8383
You can simply use ->cache() and it will set cache to 60 minutes, but you can also say ->cache(180) to cache for 180 minutes.
8484

8585
### Length - default: 2
86-
```php
86+
````php
8787
$image = $avatar->name('John Doe Johnson')->length(3)->generate(); // 3 letters = JDJ
88-
```
88+
````
8989

9090
### Rounded - default: false
91-
```php
91+
````php
9292
$image = $avatar->rounded()->generate();
93-
```
93+
````
9494

95-
I recommend that you simply **do not** enable rounding, as the edges can become way too sharp, compared to simply setting `border-radius: 100%` on the image (see below)
95+
I recommend that you simply **do not** enable rounding, as the edges are way too sharp, compared to simply setting ````border-radius: 100%```` on the image (see below)
9696

9797
### Font Size - default: 0.5
98-
```php
98+
````php
9999
$image = $avatar->fontSize(0.25)->generate(); // Font will be 25% of image size.
100-
```
100+
````
101101
If the Image size is 50px and fontSize is 0.5, the font size will be 25px.
102102

103103
## Chaining it all together
104104
We will not use the ->font() method in this example; as I like the regular one.
105105

106-
```php
106+
````php
107107
return $avatar->name('Lasse Rafn')
108108
->length(2)
109109
->fontSize(0.5)
@@ -113,13 +113,12 @@ return $avatar->name('Lasse Rafn')
113113
->cache()
114114
->generate()
115115
->stream('png', 100);
116-
```
116+
````
117117

118118
Now, using that in a image (sized 48x48 pixels for retina):
119-
```html
119+
````html
120120
<img src="url-for-avatar-generation" width="48" height="48" style="border-radius: 100%" />
121-
```
122-
121+
````
123122
Will yield:
124123

125124
<img src="https://raw.githubusercontent.com/LasseRafn/php-initial-avatar-generator/master/demo_result.png" width="48" height="48" alt="Result" style="border-radius: 100%" />
@@ -132,4 +131,4 @@ Will yield:
132131

133132
## Supported Image Libraries (from intervention/image)
134133
* GD Library (>=2.0)
135-
* Imagick PHP extension (>=6.5.7)
134+
* Imagick PHP extension (>=6.5.7)

0 commit comments

Comments
 (0)