Skip to content

Commit e4a1dca

Browse files
committed
v1
1 parent 257f4a2 commit e4a1dca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2546
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor
2+
/composer.lock
3+
/nbproject
4+
/tests/_output/*
5+
/tests/_support/_generated/*

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
TextImage: A simple PHP library to convert text to images.
2+
======
3+
4+
[![Downloads this Month](https://img.shields.io/packagist/dm/rathouz/text-image.svg)](https://packagist.org/packages/rathouz/text-image)
5+
[![Latest stable](https://img.shields.io/packagist/v/rathouz/text-image.svg)](https://packagist.org/packages/rathouz/text-image)
6+
7+
8+
Requirements
9+
------------
10+
11+
Library **rathouz/text-image** requires **PHP 5.4**.
12+
For other requirements, please see
13+
[composer.json](https://github.com/minhchu/text-image/blob/master/composer.json)
14+
15+
16+
Installation
17+
------------
18+
19+
The best way to install **rathouz/text-image** is using
20+
[Composer](http://getcomposer.org/):
21+
22+
```sh
23+
$ composer require rathouz/text-image
24+
```
25+
26+
27+
Documentation
28+
------------
29+
30+
Learn more in the
31+
[documentation](https://github.com/minhchu/text-image/blob/master/docs/en/index.md).
32+
33+
Contributing
34+
------------
35+
36+
All contributions are **fully welcome**. Please share your ideas, test and report
37+
[issues](https://github.com/rathouz/text-image/issues/).
38+
Please see
39+
[contributing file](https://github.com/rathouz/text-image/blob/master/docs/en/contributing.md).
40+
for more info.
41+
42+
License
43+
------------
44+
45+
You may use "Rathouz libraries" under the terms of either the
46+
[New BSD License](https://github.com/rathouz/text-image/blob/master/license.md)
47+
or the GNU General Public License (GPL) version
48+
[2](http://www.gnu.org/licenses/gpl-2.0.html)
49+
or
50+
[3](http://www.gnu.org/licenses/gpl-3.0.html).
51+
52+
-----
53+
54+
See also:
55+
[rathouz.cz](http://rathouz.cz) /
56+
[other repositories](http://github.com/rathouz)
57+
.

codeception.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
actor: Tester
2+
paths:
3+
tests: tests
4+
log: tests/_output
5+
data: tests/_data
6+
support: tests/_support
7+
envs: tests/_envs
8+
settings:
9+
bootstrap: _bootstrap.php
10+
colors: false
11+
memory_limit: 1024M
12+
extensions:
13+
enabled:
14+
- Codeception\Extension\RunFailed
15+
modules:
16+
config:
17+
Db:
18+
dsn: ''
19+
user: ''
20+
password: ''
21+
dump: tests/_data/dump.sql

docs/en/contributing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Contributing
2+
======
3+
4+
TBD.

docs/en/index.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
Documentation
2+
======
3+
4+
## Examples ##
5+
6+
### Basic image ###
7+
8+
```ruby
9+
$basicImage = new \Rathouz\TextImage\TextImage('Basic image');
10+
$image = $basicImage->generate();
11+
echo $image->getHtmlTag();
12+
```
13+
14+
![alt tag](https://raw.githubusercontent.com/rathouz/text-image/master/examples/assets/images/image1.png)
15+
16+
### Image with background ###
17+
18+
```ruby
19+
$backgroundImage = new \Rathouz\TextImage\TextImage('Image with background');
20+
$backgroundImage->setBackgroundColor($greyColor);
21+
$image2 = $backgroundImage->generate();
22+
echo $image2->getHtmlTag();
23+
```
24+
25+
![alt tag](https://raw.githubusercontent.com/rathouz/text-image/master/examples/assets/images/image2.png)
26+
27+
### Image with background image ###
28+
29+
```ruby
30+
$backgroundImage = new \Rathouz\TextImage\TextImage('Image with background image');
31+
$backgroundImage->setBackgroundImage('/path/to/image.png');
32+
$image = $backgroundImage->generate();
33+
echo $image->getHtmlTag();
34+
```
35+
36+
### Image with background watermark (image) ###
37+
38+
```ruby
39+
// Watermark is automatically centered
40+
$backgroundImage = new \Rathouz\TextImage\TextImage('Image with watermarks');
41+
$backgroundImage->setHeight(250);
42+
$backgroundImage->setWatermarkImage('/path/to/image.png');
43+
$image = $backgroundImage->generate();
44+
echo $image->getHtmlTag();
45+
```
46+
47+
![alt tag](https://raw.githubusercontent.com/minhchu/text-image/master/examples/assets/images/image10.png)
48+
49+
### Image with background watermark (text) ###
50+
51+
```ruby
52+
// Watermark is automatically centered
53+
$backgroundImage = new \Rathouz\TextImage\TextImage('Image with watermarks');
54+
$backgroundImage->setHeight(250);
55+
$backgroundImage->setWatermarkText('Hello world');
56+
$backgroundImage->setWatermarkTextAngle(45);
57+
$image = $backgroundImage->generate();
58+
echo $image->getHtmlTag();
59+
```
60+
61+
![alt tag](https://raw.githubusercontent.com/minhchu/text-image/master/examples/assets/images/image10.png)
62+
63+
### Image with border ###
64+
65+
```ruby
66+
$borderedImage = new \Rathouz\TextImage\TextImage('Image with border');
67+
$borderedImage->setBackgroundColor($greyColor);
68+
$borderedImage->setBorder(3);
69+
$borderedImage->setBorderColor($blackColor);
70+
$image3 = $borderedImage->generate();
71+
echo $image3->getHtmlTag();
72+
```
73+
74+
![alt tag](https://raw.githubusercontent.com/rathouz/text-image/master/examples/assets/images/image3.png)
75+
76+
### Image with blue text color ###
77+
78+
```ruby
79+
$coloredImage = new \Rathouz\TextImage\TextImage('Image with blue text color');
80+
$coloredImage->setBackgroundColor($greyColor);
81+
$coloredImage->setTextColor($redColor);
82+
$image4 = $coloredImage->generate();
83+
echo $image4->getHtmlTag();
84+
```
85+
86+
![alt tag](https://raw.githubusercontent.com/rathouz/text-image/master/examples/assets/images/image4.png)
87+
88+
### Image with custom padding ###
89+
90+
```ruby
91+
$paddedImage = new \Rathouz\TextImage\TextImage('Image with custom padding');
92+
$paddedImage->setBackgroundColor($greyColor);
93+
$paddedImage->setPadding(30);
94+
$image5 = $paddedImage->generate();
95+
echo $image5->getHtmlTag();
96+
```
97+
98+
![alt tag](https://raw.githubusercontent.com/rathouz/text-image/master/examples/assets/images/image5.png)
99+
100+
### Image with wrapped text ###
101+
102+
```ruby
103+
$wrappedImage = new \Rathouz\TextImage\TextImage('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac eros finibus, pretium erat non, fermentum leo. Curabitur hendrerit lobortis risus.');
104+
$wrappedImage->setBackgroundColor($greyColor);
105+
$wrappedImage->setPadding(30);
106+
$image6 = $wrappedImage->generate();
107+
echo $image6->getHtmlTag();
108+
```
109+
110+
![alt tag](https://raw.githubusercontent.com/rathouz/text-image/master/examples/assets/images/image6.png)
111+
112+
### Image with custom line height set ###
113+
114+
```ruby
115+
$lineImage = new \Rathouz\TextImage\TextImage('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac eros finibus, pretium erat non, fermentum leo. Curabitur hendrerit lobortis risus.');
116+
$lineImage->setBackgroundColor($greyColor);
117+
$lineImage->setPadding(30);
118+
$lineImage->setLineHeight(40);
119+
$image7 = $lineImage->generate();
120+
echo $image7->getHtmlTag();
121+
```
122+
123+
![alt tag](https://raw.githubusercontent.com/rathouz/text-image/master/examples/assets/images/image7.png)
124+
125+
### Image with stripped text ###
126+
127+
```ruby
128+
$strippedImage = new \Rathouz\TextImage\TextImage('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac eros finibus, pretium erat non, fermentum leo. Curabitur hendrerit lobortis risus.');
129+
$strippedImage->setBackgroundColor($greyColor);
130+
$strippedImage->setStripText(TRUE);
131+
$image8 = $strippedImage->generate();
132+
echo $image8->getHtmlTag();
133+
```
134+
135+
![alt tag](https://raw.githubusercontent.com/rathouz/text-image/master/examples/assets/images/image8.png)
136+
137+
### Image with custom font ###
138+
139+
```ruby
140+
$customFontImage = new \Rathouz\TextImage\TextImage('OpenSans-Bold.ttf');
141+
$customFontImage->setFontPath(__DIR__ . '/assets/fonts/open-sans/OpenSans-Bold.ttf');
142+
$customFontImage->setBackgroundColor($greyColor);
143+
$image9 = $customFontImage->generate();
144+
echo $image9->getHtmlTag();
145+
```
146+
147+
![alt tag](https://raw.githubusercontent.com/rathouz/text-image/master/examples/assets/images/image9.png)

0 commit comments

Comments
 (0)