2017 © Pedro Peláez
 

library text2pic

文字生成图片,生成长微博,text generate picture

image

dsgygb/text2pic

文字生成图片,生成长微博,text generate picture

  • Friday, October 2, 2015
  • by dsgygb
  • Repository
  • 3 Watchers
  • 42 Stars
  • 160 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 11 Forks
  • 1 Open issues
  • 12 Versions
  • 8 % Grown

The README.md

php文字生成图片(使用composer构建)

生成后的图片界面是仿照锤子便签的生成长微博的界面,使用的是苹方字体,你也可以选择使用你自己的喜欢的字体,非常容易配置。, (*1)

如何使用?

使用composer安装本模块后,仅仅需要3行代码就可以生成了:, (*2)

$ composer require dsgygb/text2pic
$ touch test.php

<?php

require 'vendor/autoload.php';

$transform = new Text2pic\Transform('by text2pic');
$result = $transform->generate("hello world");

在浏览器访问该网页:, (*3)

output:

Array
(
[code] => 200,
[message] => ok,
[data] => Array
    (
        [url] => "pic url",
        [path] => "pic path"
    )

)

详细参数

实例化

$transform=new Text2pic\Transform($by,$uploadsPath,$uploadsUrl,$fontPath);

$by :可选,string,生成后的图片的后缀,默认为空;, (*4)

$uploadsPath:可选,string,保存生成后的图片的路径,如果填写此参数,则必须填写$uploadsUrl:参数,默认为当前的包下面的'src/Publics/uploads';, (*5)

$uploadsUrl:可选,string,自定义路径后的该路径的url访问的绝对地址;, (*6)

$fontpath: 可选,string,自定义字体文件的路径, (*7)

调用生成图片的方法

$transform->generate($text,$footer);

$text:必填,string,填写生成图片的内容。支持"\n"换行, (*8)

$footer:可选,string,填写图片左下角的小号的字, (*9)

调用返回

Array
(
[code] => 200,
[message] => ok,
[data] => Array
    (
        [url] => "pic url",
        [path] => "pic path"
    )

)

如果返回的数组的code==200,则成功生成,其他情况则生成失败,调用message查看错误信息。, (*10)

data里的url是生成的图片网址,path是生成图片的路径,你可以用这个路径去上传图片到又拍云或者其他地方,然后可以unlink(删除)这个文件。, (*11)

图片示例: , (*12)

欢迎使用和提建议。, (*13)

The Versions

02/10 2015

v1.2.9

1.2.9.0 https://github.com/dsgygb/text2pic

文字生成图片,生成长微博,text generate picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic 文字生成图片 generate picture

02/10 2015

v1.2.6

1.2.6.0 https://github.com/dsgygb/text2pic

文字生成图片,生成长微博,text generate picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic 文字生成图片 generate picture

02/10 2015

v1.2.8

1.2.8.0 https://github.com/dsgygb/text2pic

文字生成图片,生成长微博,text generate picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic 文字生成图片 generate picture

02/10 2015

dev-master

9999999-dev https://github.com/dsgygb/text2pic

文字生成图片,生成长微博,text generate picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic 文字生成图片 generate picture

02/10 2015

v1.2.5

1.2.5.0 https://github.com/dsgygb/text2pic

文字生成图片,生成长微博,text generate picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic 文字生成图片 generate picture

01/10 2015

v1.2.1

1.2.1.0 https://github.com/dsgygb/text2pic

文字生成图片,生成长微博,text generate picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic 文字生成图片 generate picture

01/10 2015

v1.2.2

1.2.2.0 https://github.com/dsgygb/text2pic

文字生成图片,生成长微博,text generate picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic 文字生成图片 generate picture

01/10 2015

v1.2.0

1.2.0.0 https://github.com/dsgygb/text2pic

文字生成图片,生成长微博,text generate picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic 文字生成图片 generate picture

01/10 2015

v1.1.0

1.1.0.0 https://github.com/dsgygb/text2pic

文字生成图片,生成长微博,text generate picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic 文字生成图片 generate picture

01/10 2015

v1.0.2

1.0.2.0 https://github.com/dsgygb/text2pic

text to picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic pic

30/09 2015

v1.0.1

1.0.1.0 https://github.com/dsgygb/text2pic

text to picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic pic

30/09 2015

v1.0.0

1.0.0.0 https://github.com/dsgygb/text2pic

text to picture

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

text2pic pic