Download the PHP package ivone/text2pic without Composer

On this page you can find all versions of the php package ivone/text2pic. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package text2pic

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

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

如何使用?

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

$ composer require dsgygb/text2pic
$ touch test.php

<?php

require 'vendor/autoload.php';

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

在浏览器访问该网页:

output:

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

)

详细参数

实例化

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

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

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

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

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

调用生成图片的方法

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

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

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

调用返回

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

)

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

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

图片示例:

欢迎使用和提建议。


All versions of text2pic with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
ext-gd Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ivone/text2pic contains the following files

Loading the files please wait ....