gladx/fa-gd

Fa-GD,用于在php GD等中使用的免费波斯字母转换器。此库源自https://github.com/mahmoud-eskandari/PersianRender,并再次分支自https://github.com/patriotblog/fa-gd

dev-master 2017-10-14 16:32 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:01:30 UTC


README

此库源自PersianRender,并再次从patriotblog分支而来

安装

使用Composer

您可以使用composer安装此包。将此包添加到您的composer.json

"require": {
	"gladx/fa-gd": "dev-master"
}

手册


 \FaGD\PPersianRender::render('کتابخانه ی رندر GD image در php');

在Gd图像中使用

<?php
header('Content-Type: image/jpeg');
$width = 1280;
$height = 400;
$canvas = imagecreate($width, $height);

$black = imagecolorallocate($canvas, 0, 0, 0);
$font = './font-name.ttf';

$text  = \FaGD\PPersianRender::render('فارسی',true); //Reversed text for GD
imagettftext($canvas, 12, 0, 200, 200, $black, $font, "convert :" . $text);

imagejpeg($canvas);
// Clear Memory
imagedestroy($canvas);

#测试

phpunit