Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
amirhosein45 authored Apr 9, 2022
1 parent ab5bc9f commit fa2c8ff
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions README.md
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');
}
}

```

0 comments on commit fa2c8ff

Please sign in to comment.