-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab5bc9f
commit fa2c8ff
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,76 @@ | ||
# PersianGD | ||
Codeigniter library to solve Persian problem with GD | ||
|
||
This library helps you to use Persian characters with GD in codeignietr 4.x | ||
|
||
# Installation | ||
*** | ||
1. [Download](https://github.com/amirhossein2020/PersianGD/archive/refs/heads/main.zip) the source files | ||
2. Copy the folder `Libraries` to `app` folder of your CodeIgniter installation | ||
3. That's it! Start using with the examples below | ||
|
||
### Quick Start | ||
*** | ||
Let's get started :) | ||
First, we will load the PersianGD Library into the system | ||
|
||
```php | ||
use App\Libraries\PersianGD; | ||
``` | ||
|
||
That was easy! | ||
|
||
Now let's create object of PersianGD | ||
|
||
```php | ||
$gd = new PersianGD(); | ||
``` | ||
|
||
OK, now we can get text ready to use with gd | ||
|
||
|
||
```php | ||
$str = 'سلام امیر'; | ||
$tx = $gd->convert_to_persian($str); | ||
``` | ||
|
||
You have reached the end of the Quick Start Guide, but please take a look at the Example code section | ||
|
||
## Example code | ||
|
||
```php | ||
<?php | ||
|
||
namespace App\Controllers; | ||
|
||
use Config\Services; | ||
use App\Libraries\PersianGD; | ||
|
||
class Home extends BaseController | ||
{ | ||
public function index() | ||
{ | ||
|
||
$str = 'سلام ستنبالتنیبالایبت'; | ||
|
||
$gd = new PersianGD(); | ||
$tx = $gd->convert_to_persian($str); | ||
|
||
$image = Services::image('gd') | ||
->withFile(WRITEPATH . 'uploads/image/mypic.jpg') | ||
->text($tx, [ | ||
'color' => '#fff', | ||
'opacity' => 0, | ||
'withShadow' => false, | ||
'hAlign' => 'center', | ||
'vAlign' => 'bottom', | ||
'fontPath' => APPPATH . 'Fonts/BRoya.ttf', | ||
'fontSize' => 20 | ||
]) | ||
->save(WRITEPATH . 'uploads/image/img.jpg'); | ||
|
||
return view('welcome_message'); | ||
} | ||
} | ||
|
||
``` |