Download the PHP package zmxy/lattice without Composer

On this page you can find all versions of the php package zmxy/lattice. 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 lattice

image-20230112134617375

入门

这是什么

LatticePHP是一个点阵图生成软件包,用于PHP生成点阵图。由于点阵图生成一般是嵌入式语言所需要的,而PHP几乎不使用,于是我开发了这一款冷门的软件包,希望能帮助你。

环境

安装

使用composer安装

或者前往GitHub仓库下载源文件,自行手动导入

使用

先创建一个画布

这样子我们就创建了一个296X128的一个画布

接下来往上写字

效果如下

image-20230112142505111

画一个矩形

效果如下

image-20230112144256556

画二维码

输出HTML来看看效果

202301121346500.png

完整Demo

代码文档

画布

您在做任何操作之前起码得先创建一个画布。

字体

获取点阵字体

普通的字体因为加了锐角、美化是不能直接用来生成点阵图的,必须使用点阵字体。但是这方面的市场非常小,所以做的人很少,仅有的几个还会收取高昂费用。

这里提供一个工具用来生成点阵字体。

需要注意的是,如果源字体不可商用,您也无法将这个点阵字体商用,请尊重版权。本文会用免费的宋体来演示。

点阵工具下载

这里面主要是设置字号和字体宽高度,宽高要保持8的倍数,比如12号字体宽高填16。

image-20230112163019884

格式 bin 然后保存即可。

代码里使用

这里第一个参数是字体路径,第二个是中文宽度,第三个是英文宽度,因为英文比中文短一半,所以设置为8。(设置英文宽度主要是去除多余空白,不然影响美观)

颜色

LatticePHP是用 1 表示黑色 0 表示白色 (后期可以考虑加入其他颜色)。本质上点阵图就是一串01010101.

颜色反转

您可以传入$lattice->image,因为这个是整张画布,如这么做将会把整张画布颜色反转。

坐标偏移

所有绘制的图像需要设置X、Y坐标与偏移指令,例如:

除了top-center,还有top-righttop-leftbottom-centerbottom-leftbottom-rightcenter-rightcentercenter-left

意思应该懂吧,top-center就是Y轴靠上,X轴居中,以此类推。

文本

参数$getType的意思是返回一个由01构成的数组。

例如:

image-20230112170601447

图形

直线

矩形

插入自定义图片

条码

因为条码种类繁多,所以LatticePHP内置了CodeItNow来生成条码,先生成图片,然后再插入。

一维码

二维码

输出画布

我们有时候需要预览画布,您可以通过LatticeOutput这个工具类进行输出

输出HTML

输出数组

通过<pre>这个标签可以格式化输出

输出16进制

将图片的01当做二进制转换为16进制

其他

截取

有时候您插入了一个超过了整张画布的图片,它不会报错,但肯定会影响您的程序。您需要使用这个方法进行画布截取。

这将会把超出画布的元素截取掉。

字符串换行

默认情况下一个字符串超出时不会换行,您可以通过这个函数进行换行

ABABAB合并字符串


All versions of lattice with dependencies

PHP Build Version
Package Version
No informations.
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 zmxy/lattice contains the following files

Loading the files please wait ....